Dynamically create drop down box with JSP

Hi,
I hope this is not a repeat post, I have search the forum and a posting has not jumped out at me. I am making a jsp that dynamically constructs a custom SQL query.
I have a number of text boxes with an id, my jsp page calls a servlet, the servlet reads the contorl id and the value to build the query - this works great. However, there's a large text input box which receives a number of extra conditions - this text box receives the input in the following format:
searchAttributeName1,searchAttributeValue1;searchAttributeName2,searchAttributeValue2
This is functional, however, it's a bit rubbish as the user has to know the special recognised attributeNames. What I would like to have is some sort of criteria control. This would consist of a drop down box populated from the servlet, a text input for the value and a button to add another criteria control. so the user could build up the number of query criteria. The drop down box ensures they cannot select the wrong keyword, pressing the add criteria button adds a new drop down box and text box pair to the screen.
An example of this I recently saw was at Intel's jobs search web site https://jobs.intel.com/jobs/jobs.iccw - see that for example.
Has anyone got any ideas on how to achieve this? I initially thought use jsp scripting (there is no restriction against this) but I need to use javascript I'm guessing as the button click triggers adding a new combo box. Another idea was to use styles and tables to hide the other drop down boxes but this seems like a real hack that I'd like to avoid. I can do with with .NET i hope java can deliver!
Any ideas are much appreciated - I am a novice with java web development so please, any examples thoroughly explain (no need to explain populating the drop down box - there seem to be plenty of posts on this).
Thanks for any help or ideas on this issue -

Gina,
Here is some sample code for using a ComboBox in a JSP from an EditCurrentRecord bean. This particular example uses a query, you can also populate combo boxes, list boxes, radio buttons and checkboxes from a static list. See the JavaDocs for the EditCurrentRecord bean.
<jsp:useBean id="RowEditor" class="oracle.jbo.html.databeans.EditCurrentRecord" scope="request">
<%
RowEditor.initialize(application, session , request, response, out, "wt_bc_WT_bcModule.WalkthroughEngineSlidesView");
RowEditor.setTargetUrl("WalkthroughEngineSlidesView_SubmitInsertForm.jsp");
RowEditor.createNewRow();
RowEditor.setReleaseApplicationResources(true);
RowEditor.useComboBox("Presname","select pres_name,pres_name from wt_info","PRES_NAME","PRES_NAME");
RowEditor.render();
%>
</jsp:useBean>
null

Similar Messages

  • How To Create Drop Down Menu With Tab

    hi
    How To create Drop Down Menu with tab in Header of application like website Horizontal Dropdown Menu In html.
    Thanks
    Manoj
    Edited by: Manoj Kaushik on Dec 30, 2009 4:16 AM

    Try the Apex forum {forum:id=137} someone there may have an answer.
    Which version, that could be important, XE out-of-the-box has apex 2.1 if it hasn't been upgraded to 3.x

  • Unable to delete photos from  my desktop , I get a drop down box with continued blue/ white bars - now 6 hours

    Having dragged 8 photos onto my desktop from iphoto  for the purpose of easy addition to an email , I now find that when I  dragged them to the Trash bin , they fail to delete.
    I get a drop down box with continued blue/ white bars , stating "moving to trash " .
    It's now  6 hours and I cannot stop either. Tried to shut down my computer and reboot but it won't let me . I tried  turning the power off , but the problem remains .
    Any help would be welcome.

    Hey ! 
    I have found the solution myself  !!!
    Go ..... Apple in the toolbar - Force quite - select finder - then relaunch .
    Brilliant

  • How to create Drop Down box in screen painter..??

    Can anybody give me sample code or detailed description about creating Drop-Down Box in a screen...??
    I have created the drop down box in screen..
    But how to make data to be visible in Dropdown box, when i click the drop icon in that box...???
    Regards
    Pavan Sanganal

    Here are couple of DEMO programs for the same functionality
    DEMO_DROPDOWN_LIST_BOX       
    DEMO_DYNPRO_DROPDOWN_LISTBOX 
    You execution sequence will be PBO - Process before output, then the screen is displayed and the PAI Process after input.
    Regards,
    Ravi
    Note : Please mark all the helpful answers

  • On a Mac v10.6.6 Firefox v3.6.13 Right click on Google Map does not bring up the drop down box, with the first item being directions from here, the right click does work on Google map when using Safari

    On a Mac v10.6.6 Firefox v3.6.13 Right click on Google Map does not bring up the drop down box, with the first item being "directions from here", the right click does work on Google map when using Safari

    Your above posted system details show outdated plugin(s) with known security and stability risks.
    *Shockwave Flash 9.0 r999
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    In Firefox 3.6 and later versions you need the Next-Generation Java™ Plug-In present in Java 6 U10 and later (Linux: libnpjp2.so; Windows: npjp2.dll).
    http://java.com/en/download/faq/firefox_newplugin.xml
    See also http://java.sun.com/javase/6/webnotes/install/jre/manual-plugin-install-linux.html

  • Drop-down box in JSP

    I have to make java class that will produce drop-down box in HTML page.
    Some people will laugh on this, but I'm new in java so please help me with my excersise.

    Put this in your class...
       public static String dropDownBox( ) {
          String tmp = "<SELECT SIZE=1>\n";
          tmp += "<OPTION>First</OPTION>\n";
          tmp += "<OPTION>Second</OPTION>\n";
          tmp += "</SELECT>\n";
          return( tmp );
       }And call it by doing something like...
    <%= tvrdiClass.dropDownBox() %>
    in your JSP code.

  • How do I turn-off that annoying drop-down box with the gold key that asks me if I want Firefox to save the password?

    You know what drop-down box I'm talking about. When I sign-in to an existing account, that box drops down, covering links I want to click on, asking me AGAIN if I want to save the password for 'this' [whatever site I'm on] site. NO, I DON'T! If I wanted to save the darn password, I would have clicked 'yes' about 1,000 sign-ins ago! Stop already with the asking me.! This 'gold key' feature just doesn't get it. It is a huge nusiance. Why isn't there a box to click that says "DON'T ASK ME AGAIN"?

    Do not use Clear Recent History to clear the "Site Preferences".
    * https://support.mozilla.com/kb/Clear+Recent+History
    Clearing "Site Preferences" clears all exceptions for cookies, images, pop-up windows, software installation, and passwords.

  • How to create drop-down menu with transparency

    Hello,
    Is it relatively easy to create drop-down menu's with
    transparent drop downs? Any step by step help would be greatly
    appreciated.
    I thank you in advance,
    Jaz

    jasperjaz schrieb:
    > Looks like some cool stuff. However, nothing on drop
    downs
    >
    Take a look at "Creating Animated Buttons". The Tweening of
    the text to
    the right and changing the color perhaps could be replaced or
    appended
    by your drop-down-needs? The Drop-Down is another Animated
    Button!?
    Bye
    Klaus

  • How can I go BACK to the site I was at, say, 5 site previous or forward without hitting the BACK arrow 5 times? The previous version had a drop down box with a list of previous sites I could click on.

    It can take a while to go back by hitting the back arrow again and again. The previous version had a drop down box that listed nine or ten previous URLs. This allowed me to pick out which one I wanted by clicking on that URL. Version 4 doesn't have this feature or, if it does, I cannot find it. Is this capability on Version 4, and if so, how can I find it?

    You can get the drop down list by either right-clicking on the back/forward buttons, or holding down the left button until the list appears.

  • Creating drop down menus in JSP using custom tags

    Hi, i am working on a JSP which has custom tags for displaying menubar and menus, now i want to have these menus converted into drop down menus, and the submenus displayed onmouseover event. I am getting solutions with pure html page calling javascript functions.But i dont need this, i want the work done by my TagHandler class which sends the output to output stream, which in turn is transformed in to actual HTML by a XSLT embedded in my JSP.
    Please help as i am new to custom tags, and desperately in need of help.
    If possible give some sample code or useful links.
    I will be highly grateful.
    Thankx in advance

    that's fine, but the tag has to, ultimately, generate the HTML/Javascript stuff like you've already seen.

  • How do I enable multiple dynamic drop down boxes?

    I'm using Windows 2000, Java SDK 2 Standard, Tomcat, Apache, Microsoft Access and Macromedia Dreamweaver Ultradev 4.
    With UltraDev I'm trying to create a jsp page that has more than one dynamic drop down box or more than one dynamic select list box. I can show one dynamic object and as many static objects as I need. But when I add a second dynamic drop down box, with a second recordset, the page will only display the first dynamic object and all content following that object will not display.

    Here's the code:
    <%@page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*"%>
    <%@ include file="Connections/conn.jsp" %>
    <%
    Driver DriverRecordset1 = (Driver)Class.forName(MM_conn_DRIVER).newInstance();
    Connection ConnRecordset1 = DriverManager.getConnection(MM_conn_STRING,MM_conn_USERNAME,MM_conn_PASSWORD);
    PreparedStatement StatementRecordset1 = ConnRecordset1.prepareStatement("SELECT STATE_NAME, COUNTRY FROM STATE");
    ResultSet Recordset1 = StatementRecordset1.executeQuery();
    boolean Recordset1_isEmpty = !Recordset1.next();
    boolean Recordset1_hasData = !Recordset1_isEmpty;
    Object Recordset1_data;
    int Recordset1_numRows = 0;
    %>
    <%
    Driver DriverRecordset2 = (Driver)Class.forName(MM_conn_DRIVER).newInstance();
    Connection ConnRecordset2 = DriverManager.getConnection(MM_conn_STRING,MM_conn_USERNAME,MM_conn_PASSWORD);
    PreparedStatement StatementRecordset2 = ConnRecordset2.prepareStatement("SELECT FIRSTNAME, LASTNAME, AGE FROM PLAYER");
    ResultSet Recordset2 = StatementRecordset2.executeQuery();
    boolean Recordset2_isEmpty = !Recordset2.next();
    boolean Recordset2_hasData = !Recordset2_isEmpty;
    Object Recordset2_data;
    int Recordset2_numRows = 0;
    %>
    <html>
    <head>
    <title>Untitled Document</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    </head>
    <body bgcolor="#FFFFFF" text="#000000">
    <form name="form1" method="post" action="">
    <p>
    <select name="select2">
    <option value="Canada">Canada</font></option>
    <option value="France">France</font></option>
    <option value="French Guiana">French Guiana</font></option>
    <option value="French Polynesia">French Polynesia</font></option>
    <option value="French Southern Territories">French Southern Territories</font></option>
    <option value="Germany">Germany</font></option>
    <option value="United Kingdom">United Kingdom</font></option>
    <option value="United States">United States</font></option>
    </select>
    </p>
    <p>
    <select name="select">
    <%
    while (Recordset1_hasData) {
    %>
    <option value="<%=(((Recordset1_data = Recordset1.getObject("COUNTRY"))==null || Recordset1.wasNull())?"":Recordset1_data)%>" ><%=(((Recordset1_data =
    Recordset1.getObject("STATE_NAME"))==null || Recordset1.wasNull())?"":Recordset1_data)%></option>
    <%
    Recordset1_hasData = Recordset1.next();
    Recordset1.close();
    Recordset1 = StatementRecordset1.executeQuery();
    Recordset1_hasData = Recordset1.next();
    Recordset1_isEmpty = !Recordset1_hasData;
    %>
    </select>
    </p>
    <p>
    //Here's where things go awry
    <select name="select4">
    <%
    while (Recordset2_hasData) {
    %>
    <option value="<%=(((Recordset2_data = Recordset2.getObject("FIRSTNAME"))==null || Recordset2.wasNull())?"":Recordset2_data)%>" ><%=(((Recordset2_data = Recordset2.getObject("FIRSTNAME"))==null || Recordset2.wasNull())?"":Recordset2_data)%></option>
    <%
    Recordset2_hasData = Recordset2.next();
    Recordset2.close();
    Recordset2 = StatementRecordset2.executeQuery();
    Recordset2_hasData = Recordset2.next();
    Recordset2_isEmpty = !Recordset2_hasData;
    %>
    </select>
    </p>
    <p>
    <select name="select5">
    </select>
    </p>
    <p> </p>
    </form>
    <form name="form2" method="post" action="">
    <select name="select3">
    </select>
    </form>
    <p> </p>
    </body>
    </html>
    <%
    Recordset1.close();
    ConnRecordset1.close();
    %>
    <%
    Recordset2.close();
    ConnRecordset2.close();
    %>

  • Drop down box and Dynamic presence

    I hope this makes sense.
    I have a drop down box with several values in it. Based on the user's selection, different fields and subforms will either be visible or hidden. To do this, I built a switch statement on the exit event of the drop down box. The statement works great until I start introducing dynamic properties to one of the subforms.
    Two of the fields in one repeating subform need to be hidden or set back to visible depending on the choice in the drop down box. However, once you have added multiple instances of the subform, it only hides/displays the FIRST field in the subform. I need it to hide/display ALL of those fields when the subform is repeated.
    To do this, on the first selection, I created a for statement to go through all of the instances and set all of those fields to hidden or visible as needed. However, it's not working. At all. Even on the first instance like it used to.
    I hope I'm making sense. Here is the code I am using for my for statement:
    var indNum = xfa.resolveNodes("RequestDetails.RepeatingSection[*].serialNum");
    for (var i=0; i < indNum.length; i++) {
        xfa.form.form1.Page1.RequestDetails.RepeatingSection(i).serialNum.presence = "visible";
        xfa.form.form1.Page1.RequestDetails.RepeatingSection(i).requestedNum.presence = "hidden";

    Here is what I have found, and I hope it is helpful. Where did ["+i+"] come from? It came from my brain, I guess. Trying to figure out some way of making it work, when all of the documentation's syntax seemed not to work. Even all of the books I have on Livecycle said that a simple [i] would work; but it doesn't within the resolveNode. I figured if it wasn't resolving the variable i, then maybe I needed to separate it out.
    01371406, the only error I see with your form is a null error, which my form was doing do. I'm not entirely sure why it throws back null sometimes when it's done running through the loop; it should simply stop. Nonetheless, to fix it I simply integrated an if statement within my for loop to take care of it. An example of this from my code from earlier:
    var indNum = xfa.form.form1.Page1.RequestDetails.RepeatingSection.instanceManager.count;
    for (var i=0; i < indNum; i++) {
        if (xfa.resolveNode("RequestDetails.RepeatingSection["+i+"]") == null) {
              break;
        xfa.resolveNode("RequestDetails.RepeatingSection["+i+"]").serialNum.presence = "hidden";
        xfa.resolveNode("RequestDetails.RepeatingSection["+i+"]").requestedNum.presence = "hidden";
    Something else that I found while working on this same form, that might seem obvious to others but took me a while to figure out:
    I have a switch statement with 7-8 case statements. Within each case statement, I have two for loops. The first loop I had made used the variable i and it worked fine. However, when I introduced the second for loop, also using the variable i, it freaked out and stopped working. So I switched to another variable. (In addition, the letters h, w, x, y are reserved letters; you can't use them) After switching the variable, it worked fine. So I copied the loop into the next case statement. The form broke again. Apparently I could use a for statement with the variable i in multiple cases, but not any other variable? I literally had to go through the alphabet with the second for loop in each case. What a pain. I still don't know why it was throwing a fit like that.

  • How to create a drop down box and text box in screen painter?

    Hi i am totally new to this concept of screen painter..please can any tell me
    how to create drop down box in screen painter?
    How to create or display default date and time values?
    How to create text box for giving comments?
    How to store the records that we are entering in a table?
    Please can any one send me the procedure for creating all these its very urgent useful information will be surely rewarded.

    Hi,
    Check all these.
    1.how to create drop down box in screen painter?
    To get Drop Drown Box on screen .
    Follow these steps.
    1.
    Go to T.Code SE51 and Select Laypout for the Screen.
    2.
    Double click on the field for which u want Dropdown box.
    3.
    Then U will see Name ,Text ,DROPDOWN.Click on that and select List Box or ListBox with key . Better to to select first one.
    4.
    Save and Activate ur screen .
    5.
    Enter the following piece of code in the PBO of the screen.(Change for ur requirement).
    6.
    The following code should be written under PROCESS BEFORE EVENT in the MODULE.
    TYPE-POOLS :vrm.
    DATA:
      i_natio TYPE vrm_values, "-->Table that is passed through FM vrm_set_values
      w_natio LIKE LINE OF i_natio.
    DATA:
    BEGIN OF i_t005t OCCURS 0,
        land1 TYPE t005t-land1,
        natio TYPE t005t-natio,
    END OF i_t005t.
    IF i_t005t[] IS INITIAL.
      SELECT land1 natio
         FROM t005t
           INTO TABLE i_t005t
       WHERE spras = sy-langu.
      IF sy-subrc = 0.
      LOOP AT i_t005t .
          w_natio-key = i_t005t-land1.
          w_natio-text = i_t005t-natio.
          APPEND w_natio TO i_natio.
          CLEAR w_natio.
      ENDLOOP.
      ENDIF.
    ENDIF.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
                          id = 'I_IT0002-NATIO' "-->Field for which dropdown is needed.
                    values = i_natio
    EXCEPTIONS
       id_illegal_name = 1
                OTHERS = 2.
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    * WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    2.1.How to create or display default date and time values?
    1.
    create input field for DATE and TIME on screen.ex. DATE1 and TIME1 are screen field names .
    2.
    Just assign SY-DATUM to DATE1 and SY-UZEIT to TIME1 under PROCESS BEFORE EVENT.
    3.How to create text box for giving comments?
    1.
    Define one variable in the TOP include with type STRING means Global variable.
    2.
    Create one input field by giving screen field name which u have defined in the above step.
    4.How to store the records that we are entering in a table?
    For this case.. Create one table control. you can select one record and create record in the Z table by pressing button on Application toolbar..
    Check the following steps to handle Table control.
    1).
    U should take one variable in your internal table or in structure which
    is used for table control fields
    ex :
    data :
    begin of itab occurs 0 ,
        mark type c , "This is to select the record.
        matnr like mara-matnr ,
        matkl like mara-matkl,
        maktx like makt-maktx,
    end of itab .
    Controls: TABC types TABLEVIEW using screen 100.
    2).
    This mark variable should be given in Table control properties.
    follow the path
    double click on the table control-->attributes .->select
    w/SelColumn and in that itab-mark. Check in the figure.
    [Table control properties screen|http://bp2.blogger.com/_O5f8iAlgdNQ/R99gOUH8CXI/AAAAAAAAA9I/d3gOum1fJ6s/s1600-h/pic28145-796618.jpg]
    3).
    After that. Take this example.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0100.
    LOOP AT ITAB WITH CONTROL tabc
    ENDLOOP.
    PROCESS AFTER INPUT.
    MODULE CANCEL AT EXIT-COMMAND.
    LOOP AT ITAB.
       Module read_table_control.
    ENDLOOP.
    module user_command_0100.
    In this Module read_table_control, You should write the following code
    MODULE read_table_control INPUT.
    MODIFY itab INDEX tabc-current_line."( This will update the
    "ITAB table MARK field with 'X ' whatever we have selected
    "on table control.)
    ENDMODULE.
    4)
    If you want to Delete some of the records from Table control
    follow this code …Create one pushbutton and give Fucnction code to that
    and write below code
    CASE OKCODE.
    WHEN 'CREATE'.
    LOOP AT itab WHERE mark = 'X'.
    "Use UPDATE statement to create new record.
    ENDLOOP.
    ENDCASE.
    I hope that you will get something.
    Regards,
    Venkat.O

  • Can somebody help me with drop down box in STRUTS?

    Hi GURUs:
    I am doing a drop down box with Struts, and I have seen previous post on the forum regarding how to do that.
    Basically I have 2 classes
    InquiryAction and InquiryResult.jsp
    here is the code snippet from InquriyAction
    public class InquiryAction
        extends Action {
      public ActionForward execute(ActionMapping mapping,
                                   ActionForm actionForm,
                                   HttpServletRequest request,
                                   HttpServletResponse response) {
        InquiryForm form = (InquiryForm) actionForm;
        if ( request.getParameter("submitting") == null ) {
          return mapping.findForward("inquiry");
        /** @todo get parameters and do a search **/
        /** @todo put returned serviceResult or whatever into session/request **/
        ArrayList inquiryResults = new ArrayList();
        inquiryResults.add(new InquiryResultDisplayBean("005001", "00656992",
            "04/01/02", "104.15", "AD", "Name1", "Name2", "5"));
        inquiryResults.add(new InquiryResultDisplayBean("005001", "00729912",
            "04/02/22", "55.20", "GB", "Name2", "Name2", "7"));
        request.setAttribute("inquiryResults", inquiryResults);
        request.setAttribute("hasMore", new Boolean(true));
        return mapping.findForward("results");
    }and here is where I do the population of the drop down box in my JSP code
    <td class ='resultd'>
      <html:select property="PRKey"><logic:iterate id='transaction' collection='<%= request.getAttribute("inquiryResults") %>'>   
    <html : option value="<bean:write name='transaction' property='PRKey'/>" >           
         <bean:write name='transaction' property='PRKey'/>     
    </html:option>   
    </logic:iterate>
    </html:select>
    </td>                                 However when i test the JSP page on my local app server, i got the following error:
    javax.servlet.jsp.JspException: Cannot find bean under name org.apache.struts.taglib.html.BEAN
    at org.apache.struts.taglib.html.SelectTag.calculateMatchValues(SelectTag.java:301)
    at org.apache.struts.taglib.html.SelectTag.doStartTag(SelectTag.java:244)
    at jsp_servlet.__inquiryresults._jspService(__inquiryresults.java:544)
    I did bind the "inquiryResults" with an arrayList, can somebody tell me what is wrong? thanks...

    First: You can't nest tag library tags within tag library tags, unfortunately. So this:
    <html:option value="<bean:write name='transaction' property='PRKey'/>" > ...for example, is a no-go. You'd have to write it like this:
    <html:option value="<%= transaction.getPRKey() %>" > ...Second: The easiest way to do this is if the value and label properties of the InquiryResultDisplayBean objects are proper Java bean fields, meaning PRKey field has getPRKey() method. In that case, you can do this:
    <jsp:useBean id="inquiryResults" class="full.package.InquiryResultDisplayBean" scope="request" />
    <html:select property="PRKey">
    <html:options collection="inquiryResults" property="PRKey" labelProperty="PRKey"/>
    </html:select>

  • Help with drop down box if/then function and sum

    Hi, I am hoping someone can help me with an if/then function. I have a drop down box with all of the provinces listed, then based on their choice I need to calculate provincial sales tax with a sum function for the price of the item plus the sales tax. Help!

    You can enter the sales tax rate for each province as the export value and
    then use the drop-down field directly in your calculations.
    On Thu, Feb 5, 2015 at 6:06 PM, jennam90934439 <[email protected]>

Maybe you are looking for

  • IPodMini Won't Update

    I have been trying to update my Ipod Mini but a message pops up that says, "Songs on the iPod cannot be updated because all of the playlists selected for updating no longer exist". I am sorry if this is a stupid question, but I am not sure what to do

  • How to bind a column name in PL/SQL

    i have this code in a transaction report. DECLARE q VARCHAR2 (1000); t VARCHAR2 (15); BEGIN t := '11110000'; q := q || 'select STARTDATE, PHONESOURCE, PHONETO, DURATION '; q := q || 'from TRANSACTION '; q := q || 'where TRANS_ID = ' ||t|| 'and STARTD

  • How can I play my High Definition .mts videos (taken with a Canon HF100) on ATV 3.  The videos are stored on my MAC

    Exporting them into imovies takes too much disk space (i.e. 50 GB per hour) Any help would be greatly appreciated ! Thanks

  • Buying iphone in Japan for use in Australia?

    Hey, I have just got to Japan and will be living here for the next 12 - 18 months. I want to get an iphone on contract with softbank here in Japan. Will my iphone work with an australian Sim-card when i get back home?

  • Product Hierarchy

    Hi All Everytime I add a value while creating the Product Hierarchy in V/76 - the Level field keeps defaulting to 1 I want to be able to set up tiers and hierarchial data for this field.. Is that possible? Thank you Rukshana