Displaying date in the preciding code

Ads
 

Displaying date in the preciding code

while deploying the Bill date field on this page are empty though it should be displayed

String userName = request.getParmeter("userName"); String custId = request.getParameter("customerId"); String emailId = request.getParameter("emailId"); String phoneNumber = request.getParameter("phoneNumber"); String[] dateStr = new String[3]; String[] status = new String[3]; try { //Code to connect to the database String sql = "select billid, customerid, billdate, status from customerbills where customer_id=? and status='Paid'"; PreparedStatement stmt = conn.prepareStatement(sql); stmt.setString(1, custId); ResultSet rs = stmt.executeQuery();

} conn.close(); } catch (SQLException e) { e.printStackTrace(); } catch (ClassNotFoundException e) { e.printStackTrace(); } //Code to display the details }

View Answers

March 12, 2011 at 4:14 PM

<%@page import="java.sql.*"%>
<table border=1>
<tr><th>Name</th><th>Age</th><th>Address</th><th>Phone No</th><th>Date</th></tr>
<%
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection("jdbc:odbc:student","","");
String sql = "select * from data where id= ?";
PreparedStatement stmt = con.prepareStatement(sql);
stmt.setInt(1, 1);
ResultSet rs = stmt.executeQuery();
if(rs.next()){
%>
<tr><td><%=rs.getString("name")%></td><td><%=rs.getInt("Age")%></td><td><%=rs.getString("address")%></td><td><%=rs.getInt("phoneNo")%></td><td><%=rs.getDate("date")%></td></tr>
<%
}
rs.close();
stmt.close();
con.close();
}
catch(Exception e){
System.out.println(e);
}
%>
</table>

Ads









Related Tutorials/Questions & Answers:
Displaying date in the preciding code
Displaying date in the preciding code  while deploying the Bill date...[] status = new String[3]; try { //Code to connect to the database String sql...) { e.printStackTrace(); } //Code to display the details
Displaying files on selection of date.
Displaying files on selection of date.  Hi, I am developing a GUI, where i select from and to date. On selection of from and to date the GUI should show the particular txt files of the selected date. I want the java logic
Advertisements
Displaying Date in Servlet
Displaying Date in Servlet     ... a current date and time on our browser. It is very easy to display it on our browser by using the Date class of the java.util package.  As we know that the our
Javascript get Date And Selected Option Text
. This example explains how to write the Javascript code for displaying...Javascript get Date And Selected Option Text In this tutorial we will learn about how to get Date from the textbox and displayed as Date as well as how
codes for displaying in calendar
codes for displaying in calendar  can i get jsp codes for displaying comments, when the pointer is placed over the particular date in calendar
date
date   how to insert date in database? i need coding
displaying data
displaying data   how to display data from database on jsp using struts2
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  can u tell me how to calculate difference between a user provided date and the system date in java
date
date  i want difference between the date entered in a jtextfield and the system date in java
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
date
date  how to insert date using html through the combobox
Display Date and Time - Design concepts & design patterns
Display Date and Time  HI, Can u send me Html code displaying system date and time . Thanks Prakash  Hi Friend, Try the following code: System Date and Time var date = new Date(); document.write
Image is not displaying
Image is not displaying  Hii i am using spring javamail with html template to send mail,i am facing that image displaying prob when mail have to cm in gmail,in template just i am giving my current location of image which
date
database table name birthday (DOB date); dob with DATE data type in database while...=d.getTime(); java.sql.Date date = new java.sql.Date(t); try { System.out.println(date); Class.forName("oracle.jdbc.OracleDriver"); con
displaying image
displaying image  how to upload image and retrieve it form database mysql in php?   Here is an example of uploading image using php. 1)form.html: <form method="post" enctype="multipart/form-data" action="upload.php
DATE
DATE  I have the following as my known parameter Effective Date... of calcultion starts My question is how to find the date of Thursday This cycle... the date of all the thursdays of the given year. import java.util.*; import
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
PHP Displaying URL Content
PHP Displaying URL Content  In my PHP application form, on submitting the form details it always displaying url content. Can anyone tell me what is the reason and how to restrict it from displaying
code
code   hi I need help in creating a java code that reminds user on a particular date about their festival. i have no clue of how to do it.. am looking forward to seek help from you
Java current date - How to get current date in Java
In this section, you will learn about displaying current date and time in Java
(Displaying a calendar in GUI
(Displaying a calendar in GUI  (Displaying a calendar) Write a program that displays the calendar for the current month, as Use labels, and set texts on the labels to display the calendar."The Calendar and GregorianCalendar
autocomplete displaying multiple fields
autocomplete displaying multiple fields  How can I create an autocomplete with three field (name, id, phone). Placing the phone field in the appropriate input field but selecting the name field into the 'calling' input box
Displaying java.util.Calendar using JSP struts tags
Displaying java.util.Calendar using JSP struts tags  My question is in regard to displaying a date whose source is java.util.Calendar... and display it as <s:date name="todayDate" format="yyyy-MM-dd" />
PHP Date
functions. Following code shows current date: <? $today = date("F j, Y, g:i...PHP Date  Hi, How to use PHP Date functions in my PHP program? Thanks   Hi, PHP Date functions is very handy. It is used to progracess
Displaying different portions of a page subsequently on the basis of action
Displaying different portions of a page subsequently on the basis of action  Suppose in Report.jsp there are two text fields From Date: and To Date: with js calender beside these and a SEARCH Button(When the page initially loads
Displaying file from database
Displaying file from database  I have list of files in my database. I want to display these files in browser according to the input. My need is like google search result. when i click on the link it should display
Displaying error on the Same form
Displaying error on the Same form  I want to display the errors on the same form(Top of the form) after validation. I am used Div element and Table to display the error messages. It is working properly. But those error messages
displaying a physical webpage with frames in iframe
displaying a physical webpage with frames in iframe  i have iframe...,page with frames spoils the party. my code for getting the html file <...="sss"><%=s%></a> <% } %> mycode for displaying

Ads