• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

calendar

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to display calendar in date field of this servlet .How to display it in my code?
 
Ranch Hand
Posts: 1143
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please use code tags.
to display calendar you can use java script.
have a google search for javascript calendar.

Hope this helps.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
how to insert daatbase values from database to drop down list in servlet?
 
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

try withis..check with the syntex

ResultSet rs = stmt.executeQuery("Select * from table");
out.println ("<select>");
while(rs.next()){
out.println(" <option value="+rs.getString("name")+"></option>")

}
%>
out.println ("<select>");
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tried it but it does not work....
 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
what error you are getting and can you paste that code..
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not getting any error but no item is displayed in drop down box......


String userName = "";
String password = "";
Connection con = null;
String url = "";
Class.forName ("");
con= DriverManager.getConnection (url, userName, password);



This is code
out.println("<select name=\"select5\">");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("Select NO from Emp1" );
while(rs.next())
{
out.println(" <option value=\"+rs.getString(\"NO\")+\"></option>");
}
out.println("</select>");
 
Eshwin Sukhdeve
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
archana do one thing..take StringBuffer or StringBuilder and append all the option values in this.means dont execute out.println every time and after that send to
out.println;
 
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You got no errors and no display, so have you debug the database values are being retrieved correctly before put it into <select>?
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:You got no errors and no display, so have you debug the database values are being retrieved correctly before put it into <select>?


means
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I meant to say debug can help to check out the DB values are extracted properly.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:I meant to say debug can help to check out the DB values are extracted properly.



how to debug oracle database???
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have to debug your Servlet code that extracts values from DB. Eclipse or other IDE would be very helpful for you to debug.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:Have to debug your Servlet code that extracts values from DB. Eclipse or other IDE would be very helpful for you to debug.



i have tried it also.........but does not work
 
Ranch Hand
Posts: 56
Android MyEclipse IDE Windows XP
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi every body ,

my suggestion is please use javascript callender.

 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First thing is, there is a better way to display the page you are trying in the code above, go for a JSP.
Then you can use Javascript for the calender and Java beans for DB values.
Really helps in keeping things simple and maintainable.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you got values from DB while debugging? Is the problem about to display the content retrieved?
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:Have you got values from DB while debugging? Is the problem about to display the content retrieved?



yes problem is about to display the content retrieved
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Amit Ghorpade wrote:First thing is, there is a better way to display the page you are trying in the code above, go for a JSP.
Then you can use Javascript for the calender and Java beans for DB values.
Really helps in keeping things simple and maintainable.


i have to use only servlet for my project .so please hely me to use calendar in servlet and how to retrieve values from database to drop down box in my pdf.java servlet.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Seems you have to give some text to display as caption in the <option> tag while value attribute would be sending the given value to server. Try this

out.println(" <option value=\"+rs.getString(\"NO\")+\">someText</option>");

example link : http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_option_value
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:Seems you have to give some text to display as caption in the <option> tag while value attribute would be sending the given value to server. Try this

out.println(" <option value=\"+rs.getString(\"NO\")+\">someText</option>");

example link : http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_option_value




text is being displayed in drop down box many times but database values are not being displayed
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually <option value="somtext"> won't be displayed and caption only does, this is due to hiding the actual value from the displaying one. If you want to check you can see that via page source of your web browser.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But if you want to display the actual content as you read out from DB, then just write as follows.
out.println(" <option value=\"+rs.getString(\"NO\")+\">rs.getString(\"NO\")</option>");
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:Actually <option value="somtext"> won't be displayed and caption only does, this is due to hiding the actual value from the displaying one. If you want to check you can see that via page source of your web browser.



yeah i have done this values are being displayed in page source but what should i do to display database values in drop down box then.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read my previous post.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

archana tiwari wrote:

Kumaravadivel Subramani wrote:Actually <option value="somtext"> won't be displayed and caption only does, this is due to hiding the actual value from the displaying one. If you want to check you can see that via page source of your web browser.



yeah i have done this values are being displayed in page source but what should i do to display database values in drop down box then.



but doing this we only get same text not the database values.
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've posted another after that saying as follows,

out.println(" <option value=\"+rs.getString(\"NO\")+\">rs.getString(\"NO\")</option>");
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:I've posted another after that saying as follows,

out.println(" <option value=\"+rs.getString(\"NO\")+\">rs.getString(\"NO\")</option>");



but its not working ........same value is getting printed.....i want database values
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

archana tiwari wrote:

Kumaravadivel Subramani wrote:I've posted another after that saying as follows,

out.println(" <option value=\"+rs.getString(\"NO\")+\">rs.getString(\"NO\")</option>");



but its not working ........same value is getting printed.....i want database values



please tell me the solution
 
Kumaravadivel Subramani
Ranch Hand
Posts: 171
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried this code as Eshwin Sukhdeve said? In the result set have you got anything from DB? If you struck with DB value retrieval more example available in net. Check whether result set having value or not then try to display the value.
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kumaravadivel Subramani wrote:Have you tried this code as Eshwin Sukhdeve said? In the result set have you got anything from DB? If you struck with DB value retrieval more example available in net. Check whether result set having value or not then try to display the value.




yes i have tried this code....but does not work
 
archana tiwari
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Punit Jain wrote:please use code tags.
to display calendar you can use java script.
have a google search for javascript calendar.

Hope this helps.



I am using eclipse for pdf.java program to display the calendar but no image is being displayed. there may be an error related to path of image file (.png).How to give path of png file in eclipse?
i am using java script for calendar.....
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic