Displaying date in the preciding code

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>









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 Date in jsp - JDBC
Displaying Date in jsp  I want to insert Date of birth of a person... to interact with database.My JSP code for inserting Date is below: String dateStr... SimpleDateFormat("dd-MM-yyyy "); Date result = formater.parse(dateStr
Advertisements
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
Displaying html code in pdf with itext - Java Beginners
Displaying html code in pdf with itext   Hi , I am geeting data which was enterd from fck editor. same data is stored in the database i need to display this data in the pdf . i am using itext to create
this is my code java - Date Calendar
this is my code java  /* * NewJFrame.java * * Created on 11... NOT modify this code. The content of this method is * always regenerated...); jLabel1.setText("Date now"); jLabel2.setText("Result Date
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
Jsp Code to store date in database - JSP-Servlet
Jsp Code to store date in database   Hi, Can u give me jsp code to store current date in to database. Thanks Prakash
Date and Time Format Example
Date and Time Format Example       This Example shows you date and time format according to the locale. In the code given below we are displaying data and time
jsp code for date generation - JSP-Servlet
jsp code for date generation  hai i am meyis i need a jsp program code for date generation.(mssql-back end) Fields are fromdate and todate both... the server.fromdate is current system date. how to generate the date between
Date Time Problem In Jsp code - Development process
Date Time Problem In Jsp code  Hi Friends, By using this code , am storing date and time into msaccess database. But while retriving i want to get same date and time .send me code for that. SimpleDateFormat
NSLog Date example code
In this following code we have create a variable to of NSDate class and then used the NSLog function to print the date on the console. // // ...;  today= [NSDate date];ADS_TO_REPLACE_5     NSLog(@"
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
How to write the code for date in swings - Struts
How to write the code for date in swings  Hi Friends, I want to code for display the calendar.......technologies use only swing and core java also how to display calendar like that popup window.....please write and send me
Two Dates code validation - Date Calendar
Two Dates code validation  Hi Sir.I am using calender for two text fields which is Date of birth and date of joining.i want validate date of join should be greater than date of birth.plz help me in code .  Hi Friend
Code to insert date in to database - Development process
Code to insert date in to database  Hi , in my following code i want to store date in to msaccess database. i have tried many queries, but am getting error . plz send me code Error 500--Internal Server Error
php code: how to insert manual date and also retrieve records by selecting date field. - Date Calendar
php code: how to insert manual date and also retrieve records by selecting date field.  In PHP, how to insert user input date on mysql db. and also... to get the records by selecting date field in mysql. Please give me a correct code
PHP Displaying the date and time in your timezone Tutorial
PHP Date Time Zone       In PHP Date Time Zone class displays the time of different time zone, along with time it is also capable of displaying the longitude, latitude and comment
Struts: validations code to support 2 date foramats - Struts
Struts: validations code to support 2 date foramats  What is the code in validation.xml to support 2 date formats (DD-MM-YYYY & DD/MM/YYYY ) in form. (I'm using struts 1.3
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
javascript cal code for selecting date in text field - JSP-Servlet
javascript cal code for selecting date in text field  HI I want javascript calendar code to select date in text field in jsp.pls send me?  Hi Friend, Please visit the following links: http://www.roseindia.net
j2me code - Date Calendar
Java Script Code of Calendar and Date Picker or Popup Calendar
Java Script Code of Calendar and Date Picker or Popup Calendar...; This is detailed java script code that can use for Calendar or date picker or popup... selected date from the date picker.  2: calendar.js: Java script code file
displaying data
displaying data   how to display data from database on jsp using struts2
date
date   how to insert date in database? i need coding
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
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
displaying - Ajax
explain in detail and send me source code. Please visit for more information
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
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
Displaying images - JDBC
Displaying images  How to display multiple images on a single jsp from MySql database
image displaying in java
image displaying in java  how to display an image by using load image button in applet viewer
displaying in ajax - Ajax
displaying in ajax  hi.. I have an Ajax page ,request gone to server... the current date and time from server and shows on the form. To view the current date and time click on the following button
(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
code
code  please provide code for custom tags.by using currdate tag we need to get current date?please give me code
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
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
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
xml displaying a drives data.....
xml displaying a drives data.....  Hi all, I need a solution for displaying content of a drive(Ex: c , d , e ) in the browser using the XML... all, I need a solution for displaying content of a drive(Ex: c , d , e
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 Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from... servlet or jsp  Hi friend, This is form code, display data... information, http://www.roseindia.net/servlets/   Display code
date format - Date Calendar
date format  how to convert dd-mmm-yyyy date format to gregorian calendar format in JSP please tell me the code  Hi friend, Code to convert date to calender. import java.util.*; import java.text.*; public

Ads