Populating a Drop down menu JSP form

How to go about populating a drop-down form from Oracle Database using JSP?
I have the connecting to the Oracle Database running. I also can query forms, but i can't create a drop-down menu form.

Start the dropdown box with the regular select tags "<select name=this>"
Then open a JSP block and get a resutlset, loop through the resultset and and put the values from the resutlset into the <option> tags for the HTML.
Example
out.println("<option value=\"" + rs.getString(1) + "\">" + rs.getString(1) + ">");
Then close the loop and that should populate a dropdown within the html form.

Similar Messages

  • Is it possible to create a drop down menu using form fields rather than text?

    Is it possible to create a drop down menu using form fields rather than text?

    Yes, correct - values of form fields. If one is blank, then the field would be blank - yes? If two or more have the same value that is fine.
    A standard dropdown ... As shown here. If there is an easier way to do this, I'd love to hear your suggestions. Thank you!

  • Populating a Drop Down menu from a EJB

    Hi,
    I have a scenario where the the user clicks on the one of the links on Page A and then the page navigates to Page B. On the Page B a drop down menu appears. Now I have to implement such that the drop down menu has to be populated dynamically by values returned from the EJBs which will be called when the link on the Page A is clicked.
    Can any one giude me as to how to do this.
    Thanks in Advance. !!

    Just write code logic in the bean action method behind the commandLink accordingly?

  • Populating a Drop-Down Menu via xml in php

    I am new at programming. I am looking for a way to link a drop menu to 3 drop down menus dynamically. In other words, the 3 ddm's will have the same options according to the value selected in first ddm. Can someone provide a tutorial for this? Also, i am using php to pull the data for those ddm's from xml file.
    Thank You

    php is server side... so you want user to choose option from dd menu #1, reload the page to populate dd menu #2 (process on server via php), choose option from dd menu #2, reload the page again to populate dd menu #3 (process on server via php), then finally choose option from dd menu #3 and then after reloading the page three times already (once for initial load and two more time for each subsequent server process) load the page for a fourth time to process the entire form entry? Whoa daddy... that's a lot of page loads.
    Just want to be clear of your desire. I don't think you'll find many tutorials for the mentioned method. There are many, many three tier drop down menus in javascript that provide client side processing without page reload.

  • Looping through collection of symbols and populating a drop down on a form EXTENDSCRIPT

    Hello everyone-
    I got a question.  Would it be possible to run a script that would loop through a collection of symbols in a defined library and populate a drop down with the available symbols. My goal is to be able to open Illustrator, and when I run the script the dropdown is populated with all available symbols(text is fine) in a defined library that I can then select and place on the artboard. Any help would be appreciated.
    thanks in advance!

    So...
    Dim appref As New Illustrator.Application
    Dim docRef As Illustrator.Document                                                                         'The work document
    Dim docToAdd As Illustrator.Document                                                                   'The document which contain the symbol's library 
    Dim pathArt As Object
    Dim ItemSymbol As Object
    Dim itemSymbolref As Illustrator.Symbol
    Dim artObject As Variant
    appref.Open ("C:\..... workDoc.ai")
    Set docRef = appref.ActiveDocument                                                                         'Assign docRef to your work document
    appref.Open ("C:\......symbolDoc.ai")
    Set docToAdd = appref.ActiveDocument                                                                    'Assign docToAdd to your symbol document
    Set symbolref = appref.ActiveDocument.Symbols(Symbol_Name)                               'Assign symbol ref the symbol you're looking for
    Set itemref = appref.ActiveDocument.SymbolItems.Add(symbolref)                              'Copy it on the current active page
    itemref.Selected = True                                                                                              'select it
    docToAdd.Copy                                                                                                         'add it to your clibboard
    docToAdd.close (aiDoNotSaveChanges)                                                                     'Close the library, without changing anything
    appref.ActiveDocument.Paste                                                                                     'Paste the clipboard on your work document
                             'As soon as you paste the symbol, it will be added in the document symbol library
    Clipboard_Clear                                                                                                         'See below why...
    SelectedObjects =appref.ActiveDocuments.selection                                                   ' Select the symbol you past
                             ' The loop is not necessary if you have only one thing selected
    For Each artObject In selectedObjects
        artObject.Delete
    Next
                             ' Cleanup your pointers
    Set artObject = Nothing
    Set pathArt = Nothing
    Set docToAdd = Nothing
    [....] Continue your script on your working document
    Set docRef = Nothing               'after closing your working doc...
    Remark on clipboard_clear : If you don't do it, the risk is to accumulate plenty other things you don't want...
    Public Function ClipBoard_Clear()
      Call OpenClipboard(0&)
      Call EmptyClipboard
      Call CloseClipboard
    End Function
    With
    Public Declare PtrSafe Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
    Public Declare PtrSafe Function CloseClipboard Lib "user32" () As Long
    Public Declare PtrSafe Function EmptyClipboard Lib "user32" () As Long
    be careful I use the PtrSafe pointer due to the fact I'm working in x64 architecture
    in x86 it will be
    Public Declare Function OpenClipboard Lib "user32" (ByVal hWnd As Long) As Long
    Public Declare Function CloseClipboard Lib "user32" () As Long
    Public Declare Function EmptyClipboard Lib "user32" () As Long
    Regards to all
    Michel

  • Populating drop down menu's from database dynamically

    Hi
    I m facing a problem of populating the drop down menu from a MS Access database using JSP. But i m not able to do it. Can you please help me out?
    this works perfectly for textarea
    <textarea cols="20" rows="20">
    <% for(int i =1; i <=rsmd.getColumnCount();++i)
    out.println(rsmd.getColumnName(i)); %>
    </textarea>
    but for drop down box it gives problems
    Heres the code!
    <select name="aa" ID = "aa">
    <option value="<% for(int i =1; i <= rsmd.getColumnCount();++i)
    out.println(rsmd.getColumnName(i)); %>" > </option>
    </select>
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 61 in the jsp file: /gv/event.jsp
    Generated servlet error:
    i cannot be resolved
    wat can be the alternative? Please hlp
    Regards
    Sami

    Hi i m facing a problem in jsp while filling the dropdown box<select name="combosubject"  width="10%" maxlength="20"/>
                                  <option ></option>
                                  <%
                                                System.out.println("1st time");
                                                rs=stmt.executeQuery("select subject.name from subject order by name");
                                                while(rs.next())
                                                  subject = rs.getString(1);
                                             %>     
                                             <option ><%=subject%></option>
                                             <%
                             rs.close();
                             stmt.close();
                       %>the problem is that when i execute this code for the first time it works fine and after that it keeps on throwing exception like "No data found", "Column not found"
    on <form> action i have recalled this function that is when i click the search button this page is executed again and at this moment i got the exception

  • Loading data in a drop down menu using jsp

    hello everyone...
    I'm very new to JSP programming....i'm facing a problem regarding loading the data in a drop down menu at the button click.....
    what i'm doing is...i'v taken a button and at the button click the data from "Sql Server 2000" shd load in a drop down menu....here's the code which i think will make my point clear....
    <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Untitled Document</title>
    <%
              Connection con=null;
              ResultSet rs=null;
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con=DriverManager.getConnection("jdbc:odbc:p_portal");
                   Statement stat=con.createStatement();
                   String sql="select * from message_box where name='anindo'";
                   rs=stat.executeQuery(sql);
                   %>
    <script language="javascript">
    function check()
         var show=document.getElementById("mydivtag");
         show.innerHTML = "<label><select name=select><% while(rs.next()){%><option><%= rs.getString(1) %></option><option><%= rs.getString(2) %></option><option><%= rs.getString(3).substring(0,10) %></option></select></label><%}}catch(Exception ex){out.print("Exception is:- "+ex);}%>";
    </script>
    </head>
    <body>
    <form id="form1" name="form1" method="post" action="">
      <label></label>
      <p>       
        <input type="submit" name="Submit" value="Submit" onclick="check()" />
           </p>
      <p>       
       </p>
      <div id="mydivtag" ></div>
      <p> </p>
    </form>
    </body>
    </html>

    yep Ajax is d right way 2 do so.
    So can use DWR(ajax tech.) for dis/
    To implement dis dere r simple steps u hav 2 follow
    1. entry for <dwr> tag in web.xml
    2. entry for <onverter>in web.xml
    3. In jsp u write
    <script type="text/javascript" src="<%=appName%>/dwr/engine.js"></script>
    <script type="text/javascript" src="<%=appName%>/dwr/util.js"></script>
    <script type="text/javascript"src="<%=appName%>/dwr/interface/ClassService.js"></script>
    were ClassService is ur class whose method u want 2 call.
    4.
    In jsp under <script> u can simply write
    ClassService.Methodname(param1,param2,....,CallBackFunction);
    5.CallBackFunction(data)
    /// do wt u want
    For more details u can find it on google.

  • Reading from HTML Drop-Down Menu into JSP

    Hi folks. I'm am just delving into JSP, and I have a very basic question. I've been looking around the internet for a good tutorial on how to read HTML form input data into my JSP page. I really haven't found anything, and was hoping that you could provide me with some good resources. I want to have just a basic HTML drop-down menu with a SQL query executed based on the menu selection. The selection from the drop-down menu should go into the SQL query where "Shawnee" currently is. Here is my JSP code:
    <%@ page contentType="text/html;charset=windows-1252" import="java.sql.*"%>
    <%     
    try
         Class.forName("net.sourceforge.jtds.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:jtds:sqlserver://khrcs4:1433/Mail_List;user=xxxx;password=xxxx");
           System.out.println("success");
           Statement st = con.createStatement();
           ResultSet rs = st.executeQuery("select * from contacts where class like '%First Time Home Buyer Lenders%' and served like '%Shawnee%' order by company");
           while(rs.next())
              out.println(rs.getString(3)+"<br>"); //company
              out.println(rs.getString(12)+"<br>"); //address
              //out.println(rs.getString(13)+"<br>"); //address2
              out.println(rs.getString(8)+", "+rs.getString(9)+" "+rs.getString(14)+"<br>"); //city, state zip
              out.println(rs.getString(7)+"<br><br>"); //phone
    catch (Exception ex)
         ex.printStackTrace();
    %>

    ArrayList recList = new ArrayList();
    while(rs.next())
         recList.add(rs.getString(3));
    put the recList in the session.
    session.setAttribute("allrecords",recList);
    Then in your jsp, get the recList from the session and loop it,
    ArrayList recList = (ArrayList)session.getAttribute("allrecords");
    for (var i=0; i < recList.size();++i){
         addOption(document.getElementById("drop-down box name"), valarray, valarray[i]);
    function addOption(selectbox,text,value)
         var optn = document.createElement("OPTION");
         optn.text = trim(text);
         optn.value = trim(value);
         selectbox.options.add(optn);

  • How do I get the VISA resource drop down menu to be auto populated in my stand alone application (exe file)?

    Hi all,
    Here's a hopefully simple question.
    I am building an application (i.e. an exe file) from a simple program which use VISA to read and write to a RS-232 com port. When I run it before building the application everything works fine and the VISA resource control, which is a drop down menu, is automatically populated with available com ports. When I run the application on a computer without LabVIEW installed nothing appears in this window. I have made an installer which includes NI LabVIEW Rutime Engine 8.5, NI Measurement & Automation Explorer 4.3 and NI-DAQmx 8.6.1. Is there anything else I need to include? Any specific settings I need to do when I build the exe-file?
    I use LabVIEW 8.5.
    Thank you.
    Solved!
    Go to Solution.

    DAQmx is only for NI DAQ cards so I'm not sure why you installed that. The driver for VISA applications is NI-VISA (surprise!)
    Add the NI-VISA run-time to your installer.

  • Adobe Form... Is there a way to use a drop down menu to highlight or note other fields...

    I am working on a simple Adobe form.  I am currently trying to figure out if there is a way to use the answers of a drop down menu to either mark, note or highlight 14 other fields.  There are 9 possibilities in the drop down menu, include a blank and NONE.
    For example if the drop down menu is set to 1, then field 9, 10 and 14 are marked, noted or highlighted. 
    Is this possible with a script?
    Thank you in advance for any help! 

    Have you looked at the properties that are available to form fields. I would look at setting the fill color or border color for a form field. Either of these can be done with Acrobat JavaScript.

  • Form2mail how do I set up the form to sent to a recipient selected from a drop-down menu?

    I am trying to configure dreamweaver form2mail to be able to send the information submitted to individual employees.  I would like the form to be set up where as you choose the recipient form a drop down menu and the only that recipient would receive the information collected on the form.  I can't seem to find any information on this.  I can only find info on sending to multiple recipients at the same time.  I only want the recipient that is selected to receive the form information.
    Alternatively, can anyone recommend a low cost or FREE form to mail system.
    Thanks in advance for your assistance!

    Jim, That is exactly what I need.  I'm using Form2Mail the Dreamweaver extension for Adobe Dreamweaver.  It only gives me the option to send to one email address or cc to multiple not individual sends.
    Here is the html
    <form action="/HDWForm2Mail/Form2Mail.php" method="post" enctype="multipart/form-data" name="form1" id="form1" accept-charset="iso-8859-1">
            <p>
              <label for="message"></label>
              <textarea name="message2" id="message" cols="50" rows="5"></textarea>
            </p>
            <table width="429">
              <tr>
                <td><strong>Recipient:</strong></td>
                <td><label for="recipient"></label>
                  <select name="recipient" id="recipient">
                    <option value="[email protected]">Mr. Person 1</option>
                    <option value="[email protected]">Mr. Person 2</option>
                    <option value="[email protected]">Mr. Person 3</option>
                  </select></td>
              </tr>
              <tr>
                <td><strong>Your Email Address:</strong></td>
                <td><label for="email"></label>
                  <input type="text" name="email" id="email" /></td>
              </tr>
              <tr>
                <td><strong>Attachment:</strong></td>
                <td><label for="file"></label>
                  <input type="file" name="file" id="file" /></td>
              </tr>
              <tr>
                <td colspan="2"><strong>To Submit your email, click the SEND button:
                  <input name="send" type="submit" id="send" onclick="MM_validateForm('email','','RisEmail','message','','R');return document.MM_returnValue" value="Send" />
                </strong></td>
              </tr>
            </table>
            <input type="hidden" name="hdwemail" id="hdwemail" value="lisa+email.com" />
            <input type="hidden" name="hdwok" id="hdwok" value="http://ricochec.com/thank-you.html" />
            <input type="hidden" name="hdwnook" id="hdwnook" value="http://ricoche.com/error.html" />
          </form>

  • Acrobat Forms - Make fillable text box appear after box checked or drop down menu item selected

    I have been asked to build an approvals form for my workplace however the approval processes vary considerably depending on the subject. I have been asked to create a list of topics in the form of check boxes or a drop down menu which will then populate a list of text boxes with differing approval authorities and corresponding spaces for signatures.  i.e. if 'Topic 1' is selected a list of names and signature spaces will appear, however if 'Topic 2' is selected a different list of names and signature spaces will appear instead.
    In order to achieve this I think I only need to find out how to link check boxes or drop down menu items to the appearance of different text boxes.
    I should also add that I am a beginner with this stuff.
    Thank you very much for any help you can provide.

    Remove the red coloured part
    ul.MenuBarHorizontal ul.MenuBarSubmenuVisible {
    left: auto;
    top:0;
    or start again with the original SpryMenuBarHorizontal.css and follow the rules as in http://www.dwcourse.com/dreamweaver/ten-commandments-spry-menubars.php#one.
    Either way will get you back on track.
    Good luck.
    Ben

  • Email form script with custom text field and drop-down menu?

    Hey, I'm building a website in iWeb - http://dl.dropbox.com/u/19707357/Website/craftpackage.html
    And I was looking for a script that could possibly send an email to me with the info a user chooses from/puts in 1. dropdown menu 2. text field 3. another text field. I'd be awesome if the fields could have a custom background or a transparent background.The drop-down menu could have any background, but it would be awesome if it could be made with custom images !

    Basic question.
    What have you yourself done to find out?
    Nothing?
    Start here :
    http://www.google.com/search?q=how+to+make+a+mail+form
    http://www.google.com/search?q=dropdown+menu+with+transparent+background
    Unfortunately, it has no dropdown menu :
    http://www.wyodor.net/blog/archives/2010/01/entry_301.html
    Btw, dropdown menus in forms at select menus. These are not the same.
    http://www.google.com/search?q=select+menu+form
    http://http://www.w3schools.com/html/html_forms.asp
    So start practicing and once everything works the way it should, display it in a html snippet.

  • Form popping up certain information once selection is chosen in drop down menu.

    Is if possible that I could have a drop down menu and once a selection is made it displays a "set information section" with pictures and logo's etc. pop's up according to that selection?

    Hi,
    Yes it is possible. you would put the respective groupings of pictures and logos in separate subforms. The subforms can be stacked one above the other and their presence set to hidden.
    Then in the exit event of the dropdown you would have either an if statement or a switch statement to change the presence:
    if (this.rawValue == "My Company")
         myCompanyLogo.presence = "visible";
         yourCompanyLogo.presence = "hidden";
    else if (this.rawValue == "Your Company")
         myCompanyLogo.presence = "hidden";
         yourCompanyLogo.presence = "visible";
    else
         myCompanyLogo.presence = "hidden";
         yourCompanyLogo.presence = "hidden";
    Basically you are setting up white space in the form and then showing the appropriate logo/picture. Here is an example of dropdowns doing different things: https://acrobat.com/#d=jD3k1sL7PGcTo6CHHTiEOA
    There is another way. You can have the logos and pictures in the form as 'image' objects that are hidden and then have an 'imagefield' object in the white space. Then the dropdown script would set the rawValue of the 'imagefield' to match the appropriate hidden 'image' object. An example is here: https://acrobat.com/#d=BI-C*vM-cryysNXA9Hpt5A
    Hope that helps,
    Niall

  • I'm trying to find a word processing app that is comparable with Microsoft word, that supports drop down menu's for filling out forms. Any recommendations?

    I'm trying to find a word processing app that is comparable with Microsoft Word, but can use drop down menu's to fill in forms? Any suggestions

    Microsoft Word for Mac
    OpenOffice
    NeoOffice
    LibreOffice

Maybe you are looking for

  • Button in Interactive Report

    Hi Friends, I want to add Button in Interactive report for each row. Is it possible to add a button.Please help me.

  • No longer able to import movies from Sony HDR-SR10

    I have a Sony HDR-SR10 camera. I have previously been able to import videos from it to iMovie '08, but now I always get an error : *An Error Occurred During Import* There was a problem importing 1 of 1 clips from your camera. Please review the import

  • How to reset a particular view object alone to it's initial state??

    Hi, My application contains view objects with custom data source implementation. One of my requirement is to reset the particular view object alone to it's initial state. I can't use rollback since it is at Db Transaction level. I searched in forums

  • I7 MacBook Pro Seizing

    In the last couple of days, my MacBook Pro has begun to stop dead in the middle of things. It may be graphics related but I cannot say if any specific application is the cause. There is no spinning cursor like users report in other threads, there are

  • Sally Mae Johnson Jones

    How do I convert a PDF to WORD docx in Adobe ExportPDF, and do I need other software, besides Adobe ExportPDF, to do it?