Results 1 to 5 of 5

Thread: DropDown list in JSP

  1. #1
    Join Date
    Mar 2010
    Posts
    372

    DropDown list in JSP

    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.

  2. #2
    Join Date
    May 2008
    Posts
    255

    Re: DropDown list in JSP

    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?

  3. #3
    Join Date
    Mar 2010
    Posts
    372

    Re: DropDown list in JSP

    Here is my code, what I am trying to do

    Code:
    JSP page:
    number <td> Journal </ td>
                            <td> <select name="NumJournal">
                            <option> <% test = new JournalDAO JournalDAO ();
                                         test.findAll ();
                            
                             %> </ Option>
    Any help on this is appreciated. Thank you.

  4. #4
    Join Date
    Dec 2009
    Posts
    178

    Re: DropDown list in JSP

    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;
          )
       )

  5. #5
    Join Date
    Mar 2010
    Posts
    162

    Re: DropDown list in JSP

    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:

    Code:
    CODE: SELECT ALL
    <% = New List testdata JournalDAO (). FindAll ();
    for (String testdata: testdata) (%>
        <option> <% = testdata.get (i). ()%></ toString option>
    <%}%>
    I'm not quite on the syntax, and if you can, it would be better to use JSTL tags.

Similar Threads

  1. Replies: 3
    Last Post: 26-03-2012, 07:01 PM
  2. dropdown list and parse xml!
    By bill90 in forum Software Development
    Replies: 2
    Last Post: 07-03-2012, 08:23 AM
  3. How to create dropdown list under tab in HTML
    By Mentos in forum Windows Software
    Replies: 3
    Last Post: 30-07-2009, 11:49 AM
  4. IE8 Dropdown list can not open
    By advsnhal in forum Windows Software
    Replies: 5
    Last Post: 09-04-2009, 01:56 PM
  5. Dropdown menus
    By SalVatore in forum Software Development
    Replies: 3
    Last Post: 17-10-2008, 05:53 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,130,827.27642 seconds with 16 queries