Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Displaying date in the preciding code
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


refilwe
Displaying date in the preciding code
1 Answer(s)      3 years and 8 months ago
Posted in : JSP-Servlet


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 }


Advertisement
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
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
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
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
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
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
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];     NSLog(@"
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
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
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
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
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
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
displaying data
displaying data   how to display data from database on jsp using struts2
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
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
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
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   how to insert date in database? i need coding
displaying - Ajax
explain in detail and send me source code. Please visit for more information
date
date  i want difference between the date entered in a jtextfield 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  can u tell me how to calculate difference between a user provided date 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
Advertisements
 

 

 

DMCA.com