Hello,
Here I have a drop down list in a jsp page that dropdownlist should be filled with data from the database and I do not know what to do I expect your help and hope to find a solution. Any help regarding this is appreciated. Thank you.
Hello,
Here I have a drop down list in a jsp page that dropdownlist should be filled with data from the database and I do not know what to do I expect your help and hope to find a solution. Any help regarding this is appreciated. Thank you.
In classical j2ee, say with a tomcat server standard, if you want to own, it takes at least break what you want done in three parts.
1) a class that calls the database and a list of dating results.
2) a jsp that displays the items contained in the list shown above in a dropdown list.
3) a servlet doGet method which will call the example cited in a class) and then redirect the response in the jsp in 2)
Of course you can put any Java code in a single jsp but it's pretty dirty. My question is: what is the point that blocked you?
Here is my code, what I am trying to do
Any help on this is appreciated. Thank you.Code:JSP page: number <td> Journal </ td> <td> <select name="NumJournal"> <option> <% test = new JournalDAO JournalDAO (); test.findAll (); %> </ Option>
Try the following code
Code:public List fndal () ( lg.debug ("Finding all instances Journal"); try ( String queryString = "from Journal"; Query qryobj = getSession (). CreateQuery (queryString); qryobj.list return (); ) Catch (RuntimeException e) ( lg.error ("find all failed", e); throw e; ) )
It seems to me natural that it does not work: you put in a single tag <option> entire contents of your list. At least you should loop on your list:
I'm not quite on the syntax, and if you can, it would be better to use JSTL tags.Code:CODE: SELECT ALL <% = New List testdata JournalDAO (). FindAll (); for (String testdata: testdata) (%> <option> <% = testdata.get (i). ()%></ toString option> <%}%>
Bookmarks