Problem in sending drop down list value to jsp page showing  null value

i am trying to send a drop down list value from client side to a jsp page but getting null value
this is first page where i have accessed data from database and putted it in a drop down list
<select name="sub">
     <%
     while(rs2.next())
     cat=rs2.getString(1);
     %><option value="<%=cat%>"><%=cat%></option><%
     }%></select>
<input type="submit" value="Go"></input>
now on submit i am going to another page
where i want the selected value from drop down list to be printed
i have used there
<%
String subject= request.getParameter( "sub.value" );
out.println(subject);
%>
but it is printing null here what is the problem that i m facing
thanx & reagrds
sweety

how to generate dynamically names for text boxes
i am generating text boxes in while loop when selecting data from database
while(rs1.next())
name=rs1.getString(1);%>
<tr>
<td>1</td>
<td><%out.println(name);
//i am printing here stud_id a unique key and want to update records from following text boxes to particular stud_id
%></td>
<td><input type="text" name="????"></input></td>
<td><input type="text" name="????"></input></td>
<td><input type="text" name="????"></input></td>
<td><input type="text" name="????"></input></td>
</tr><%
the structure is like
stud_id | attended theory | conducted theory | ateended practical | conducted practical
where attended theory, conducted theory............. are to be inputed manually for all students and then update in database
so i am facing problem in generating names for textboxes how to do that
so that those can be updated in database for particular student
Thanx & Regards
sweety

Similar Messages

  • Using selected items from drop-down list in rest of page

    Hi,
    I hope I'm able to describe clearly what's the problem.
    So I'm implementing a form for the moment. It contains a drop-down list. The user has to select one item from it and as a result another drop-down list on the same page needs to be filled with a couple of options. I wanna do this without refreshing the page, cos else I have to retrieve all the values from boxes that were allready filled in. Is it possible?
    Greetings,
    Raf

    This cn be done with javascript. But you need to cache the data on first load of your jsp.
    regards

  • Drop Down list issues in jsp

    Hi,
    I am facing an issue with drop down list in jsp pages on page postback. Let me explain in detail. I have a client.jsp page which has a drop down list and a text box. The drop down list is populated from an Action class (lets say testAction.java). In the client action form class there is a validation which requires the user to enter some value in the text box.
    So here is the problem, when the client.jsp page loads, the drop down list is populated perfectly, but then the user clicks submit button without entering anything in the textbox, the page loads again with an error message ("Please enter some value in the textbox"). At this point the drop down list does not contain any value. Any ideas what could I do?
    I am posting the code here for individual pieces,
    Struts-config.xml_
    <action path="/client" type="com.myapp.struts.testAction" scope="session">
    <forward name="success" path="/createClient.jsp"/>
    </action>
    <action input="/createClient.jsp" name="ClientActionForm" path="/createClient" scope="session" type="com.myapp.struts.ClientAction">
    <set-property property="cancellable" value="true" />
    <forward name="success" path="/loginSuccessful.jsp"/>
    <forward name="cancel" path="/Welcome.do"/>
    </action>
    index.jsp_
    <h5><html:link action="/client" styleClass="purplelink">Create a new client</html:link></h5>
    testAction.java_
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    ArrayList<String> arrList = new ArrayList<String>();
    arrList.add("sports");
    arrList.add("music");
    arrList.add("test 1");
    arrList.add("test2");
    request.setAttribute("mylist", arrList);
    return mapping.findForward(SUCCESS);
    createClient.jsp_
    <select name="droplist">
    <c:forEach var="itemName" items="${mylist}">
    <option><c:out value="${itemName}" /></option>
    </c:forEach>
    </select>
    <html:text property="clientName" />
    ClientActionForm_
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
    ActionErrors errors = new ActionErrors();
    if (getclientName() == null || getclientName().length() < 1) {
    errors.add("name", new ActionMessage("error.name.required"));
    return errors;
    Here is the process/page flow.
    index.jsp is the first page which is loaded.
    Link on index.jsp calls action="/client"
    This pulls mapping from struts-config and calls testAction.java
    This populates the arraylist and returns to the createClient.jsp page (mapping from struts-config.xml)
    Now createClient.jsp page has two fields (dropdown list and textfield=clientName) and a submit button
    if user clicks submit, clientActionForm is called and does not enter anything into clientName text field, error message is returned.
    At this point, the drop down list in createClient.jsp is not populated and is returned as empty, even though the scope=session in struts-config.xml
    Please provide some inputs on how can I handle this issue.
    Thanks
    Ashish

    I think one solution would be instead of putting the list in the request, but it in your ActionForm.
    Add a field to the ClientActionForm with getters and setters.
    Then change your action.
    ArrayList<String> arrList = new ArrayList<String>();
    arrList.add("sports");
    arrList.add("music");
    arrList.add("test 1");
    arrList.add("test2");
    ClientActionForm frm = (ClientActionForm)form;
    frm.setMyList(arrList);
    return mapping.findForward(SUCCESS);

  • I have Maveriks. I downloaded numerous ACID Fonts and purchased Stuffit as instructed by ACID Fonts in order to use them. However, now I am unable to figure out how to get them into my Font Family drop down list or insert into Pages. PLS HELP!

    I have Maveriks. I downloaded numerous ACID Fonts and purchased Stuffit as instructed by ACID Fonts in order to use them. However, now I am unable to figure out how to get them into my Font Family drop down list or insert into Pages. PLS HELP!

    Hi FancyJean!
    Here is an article for you about using Font Book and installing fonts that you have downloaded:
    Mac Basics: Font Book
    http://support.apple.com/kb/ht2509
    Thanks for being a part of the Apple Support Communities!
    Cheers,
    Braden

  • Getting problem in hiding drop down list in jsp pages

    Hi All,
    I have a jsp in which i created a tabbed panel & put 3 forms .
    1 of the form contains 3 drop dwom list & few text boxes.
    All 3 forms are inside <div> tags .
    Clicking on any one of the tab corresponding form is getting displayed with all its form fields hiding other 2 form fields.
    but problem is coming with 1 form having drop down list.
    all its field get hidden except these drop down list.
    i am using following script to hide other forms
    function showit(tab){
        if(tab == "tab1stuff"){
            document.getElementById('tab1stuff').style.zIndex="2";
            document.getElementById('tab2stuff').style.zIndex="1";
            document.getElementById('tab3stuff').style.zIndex="1";
              document.getElementById('tab4stuff').style.zIndex="1";
        else if(tab == "tab2stuff"){
            document.getElementById('tab2stuff').style.zIndex="2";
            document.getElementById('tab1stuff').style.zIndex="1";
            document.getElementById('tab3stuff').style.zIndex="1";
              document.getElementById('tab4stuff').style.zIndex="1";
        else if(tab == "tab3stuff"){
            document.getElementById('tab3stuff').style.zIndex="2";
            document.getElementById('tab1stuff').style.zIndex="1";
            document.getElementById('tab2stuff').style.zIndex="1";
              document.getElementById('tab4stuff').style.zIndex="1";
    }Plz help me in this regard.
    I used style.visible="false" but that is not working here.
    Thanks in advance.

    Thanks you very much.
    Now I am using javascript
    if(tab == "tab1stuff"){
            document.getElementById('tab1stuff').style.visibility="visible";
            document.getElementById('tab2stuff').style.visibility="hidden";
            document.getElementById('tab3stuff').style.visibility="hidden";
            document.getElementById('tab4stuff').style.visibility="hidden";
        } Its working ..Earliar it was PHP script.

  • Problems with populating Drop Down List (WD ABAP)

    Hi,
    I am trying to populate two Drop Down fields CARRID and CONNID (Type Table SPFLI) on an Adobe Interactive Form in a Web Dynpro ABAP Application.
    In the WD Context I have a node "Flights" with those attributes.
    In the WDDOINIT I populate the Context elements (just for test purposes with all entries of SPFLI).
    [code]  
    DATA:
         node_flights                        TYPE REF TO if_wd_context_node,
         elem_flights                        TYPE REF TO if_wd_context_element,
         stru_flights                        TYPE wd_this->element_flights,
         it_flights TYPE TABLE OF spfli.
    SELECT carrid connid FROM spfli INTO TABLE it_flights.
    navigate from <CONTEXT> to <FLIGHTS> via lead selection
       node_flights = wd_context->get_child_node( name = wd_this->wdctx_flights ).
    node_flights->bind_table(
        new_items            = it_flights
        set_initial_elements = ABAP_FALSE
    [/code]
    According to this
    Re: adobe form/reader  error I bound the element values property of the Enumerated Drop Down List to [code]$record.sap-vhlist.CARRID.item[*][/code], whereas <i>Object Text</i> is "Text" and <i>Object Value</i> is "Key".
    Unfortunately the DDLs on the Adobe Form are not populated with the values read from the table. I debugged the application and the values are written to the Context node.
    Do you have any further hints?
    Best regards,
    Robin
    Message was edited by:
            Robin Wennemuth

    Robin:
    Did you get this resolved? Would you please tell me how you got it done?
    Thank you,
    Fred.

  • Adobe LiveCycle Drop Down List which allows typing to filter the values in a Drop Down list

    I have a drop down list in my form with contains a lot of different numbers, text, countries, cities and states, etc.
    I would like the user to either have the option to only use the drop down list or they can type "Zapple" or any portion and have it populate the value.
    Is there a setting or code which I can use which will do this?
    Currently, if the user types the first letter or number it will take them to the beginning of the list (since I have them listed alphabetically/numerically), but I'd prefer they can type beyond the first character and pinpoint the option they're looking for.
    Thank you for any help

    The whole sample will need to be updated. As I said in the email it can be done but it will be complex. This particular sample requires an external xml file. You will need to pull this from data in the form.

  • Problem with InputRender drop down lists

    Basically, everytime i go through a particualar .particular, which initializes several View Objects for displaying various information to the system's user, in all my other .jsp forms, all the drop down lists that i create, loose all the data they should have displayed but one. That is, if they were to display 5 choices, they display only one of them.
    Clearly this is something nobody wants, and i was wondering if anyone has come across this before and if yes, then what would you recommend to me to do?
    Cheers for all you help

    Make sure you upload your spry css file too.

  • How do I pass a username form variable from a drop down list/menu to another page?

    Hi,
    I have a login_success.php page that has a drop down list/menu (which lists usernames). I want the user to click on their user name, and when they click the submit button the username information to be passed over to the username.php page which will contain a recordset, sorted by username.
    How do I pass the username info from the drop down list/menu to the username.php page?
    The drop down menu is connected to a recordset listUsername, I have filtered the recordset with the Form Variable = username, and I have used the POST method to send the username to the page username.php. I'm not sure how to structure the php or which page to place it on.
    <form id="form1" name="form1 method="post" action="username.php">
         <label for="username_id">choose username:</label>
         <select name="username_id" id-"username_id">
              <option value="1">username1</option>
              <option value="2">username2</option>
              <option value="3">username3</option>
              <option value="4">username4</option>
         </select>
         <input type="submit" name="send" id="send" value="Submit" />
         <input type="username" type="hidden" id="username" value="<?php echo $row_listUsername['username']; ?>" />
    </form>
    Could somebody help me please?
    Thanks.

    I would not post the variable over, In this case I personally would send it through the URL and use the $_GET method to retreve it. For Example.
    <html>
         <head>
              <title>Test Page</title>
              <script type="text/javascript">
                   function userID(){
                        //var ID = form1.userIDs.selectedIndex;
                        var user = form1.userIDs.options[form1.userIDs.selectedIndex].value;
                        window.location = "test.html?userID=" + user;
              </script>
         </head>
         <body>
              <form id="form1">
                   <select name="userIDs" id="userIDs" onchange="userID();">
                        <option>Select a User</option>
                        <option value="1">User 1</option>
                        <option value="2">User 2</option>
                        <option value="3">User 3</option>
                        <option value="4">User 4</option>
                   </select>
              </form>
         </body>
    </html>
    //PAGE TO RETRIEVE THE USERNAME
    <?php
    if(isset($_GET['userID'])
         $userID = $_GET['userID'];
         echo $userID;
         die;

  • Reg: Drop-Down list Box not  displaying values

    Hi Experts,
                     i am publishing a module pool program in the internet using SICF Transaction . In the internet my drop down list box is not displaying the default value  but in my sap it works fine .
    What may be the problem?
    Regards,
    Vikram

    Hello Thorsten Domsalla ,
                      My Problem is in my sap module pool program there is a drop down list box which disaplays  default values its working fine in sap gui but when i access through internet (SICF) Transaction the Drop down list box not listing out default values .
    i am using Integrated ITS Version 7.0 and Support package 08.
    Regards,
    Vikram

  • Assigning Values to Drop-Down Lists

    I am populating a drop-down list with values of vendor names from my Oracle table. However, I'm assigning the vendor name as the value for each <option> record displayed in the drop-down list. The problem I'm having is that when I select a vendor name from the drop-down list and I view to see which value was selected, I only see a partial vendor name, rather than the full name. For example, If the vendor name that is selected is "Jacks Welding", when I retrieve that selection in my JSP page, the value only comes up as "Jacks" not "Jacks Welding". I want the option value to be the vendor name, not the vendor ID. How can I retrieve the full name from the drop-down list? Below is my code for populating the vendor names.
    <select name="vendor">
         <option></option>
    <%
    queryvendor = "Select Name from AJM.Vendor ORDER BY Name";
    Statement st = conn.createStatement();
         ResultSet rs = st.executeQuery(queryvendor);
         while (rs.next()) {
              out.println( "<option value=" + rs.getString("Name") + ">" + rs.getString("Name") + "</optioN>");
         st.close();
         rs.close();
    %>
    </select>

    Have a look at the HTML your code is producing. (Hint: your browser allows you to display the HTML source of a page.) You are producing this:
    <option value=Jacks Welding>Jacks Welding</optioN>
    This is sloppy HTML, but browsers will do their best with it. Try producing this instead:
    <option value="Jacks Welding">Jacks Welding</option>

  • Drop-down list formattedValue returning value, not text

    Hi all,
    I'm having a problem with a drop-down list. I can get the information I want in Reader 9, but we only have Reader 7.0.5 distributed at the moment.
    I need to pull out its text value and its specified value, but everything I try just pulls out the specified value.
    In Reader 9 formattedValue gives me the text and rawValue will give me the specified value.
    Anyone able to help me please?
    Thanks,
    Tom

    Tom:
    It's possible, but complicated. You need to look into the field definition where we store the listbox contents. Then you can correlate the display item from the bound item. I've done this before in another context. I've appended the script I used.
    John Brinkman
    http://blogs.adobe.com/formfeed
    function getDisplayValue(vField)
    var vBoundItems = saveItems(vField);
    var vDisplayItems = dispItems(vField);
    if (vBoundItems == null || vDisplayItems == null)
    return vField.rawValue;
    for (var i=0; i<vBoundItems.length; i++)
    if (vBoundItems.item(i).value == A.rawValue)
    return vDisplayItems.item(i).value;
    return "";
    * saveItems(vField)
    * Get the list of items that are bound to the data
    * @param vField -- the list field
    function saveItems(vField)
    for (var i=0; i<vField.nodes.length; i++)
    var vChild = vField.nodes.item(i);
    if (vChild.className == "items" && vChild.save == "1")
    return vChild.nodes;
    return null;
    * dispItems(vField)
    * Get the list of display items
    * @param vField -- the list field
    function dispItems(vField)
    <items>
    <text>aaa</text>
    </items>
    <items save="1" presence="hidden">
    <text>111</text>
    </items>
    for (var i=0; i<vField.nodes.length; i++)
    var vChild = vField.nodes.item(i);
    if (vChild.className == "items" && vChild.save != "1")
    return vChild.nodes;
    return null;

  • How to show first parameter value in drop down list as a default value dynamically in ssrs report?

    Hi,
    in my ssrs report i have two parameters, accounts and Manager ,there is a cascading between the accounts parameter and manager parameter, as per the cascading we will get managers names based on the account we selected in the accounts parameter,
    my requirement is the first name in the mangers drop down list  has to get selected as default value.
    please help me with this, it is an urgent requirement.
    Thanks in advance,
    Naveen

    Hi NaveenMSBI,
    According to your description, you want to use cascading parameters in the report, if the accounts are selected when you preview the report, the first manager name will be selected from drop down list as the default value. If so, there can be two scenarios:
    • If manager is single-valued parameter, we can get Available Values and Default Values from the same query as below. Then when the accounts are selected, the first manager name will be selected as default value.
    SELECT managerName FROM table_name WHERE accounts IN (@accounts)
    • If manager is multi-valued parameter, we need to use different query for Available Values and Default Values. In this case, please refer to Patrick’s solution.
    For more information about Adding Cascading Parameters, please refer to the following document:
    http://technet.microsoft.com/en-us/library/aa337498(v=sql.105).aspx
    If you have any questions, please feel free to let me know.
    Best Regards,
    Wendy Fu

  • Error while populating drop down list with values from a database

    Hi all,
    I have a JSP page with a drop down list that is to be populated with values from a database.
    This is the code in my JSP file:
         <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) { %>
                       <option value="<%=iterator.next().intValue()%>"> <%=iterator.next().intValue()%> </option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>   The DataManager.java class simply forwards this to its respective Peer class, which has the code shown below:
          package seatplanner.model;
        import java.sql.Connection;
        import java.sql.ResultSet;
        import java.sql.SQLException;
        import java.sql.Statement;
        import java.util.ArrayList;
        /* This class handles all floor operations */
         public class FloorPeer
         /* This method returns all the floor numbers */
         public static ArrayList<Integer> getAllFloorNumbers(DataManager dataManager) {
            ArrayList<Integer> floornumbers = new ArrayList<Integer>();
            Connection connection = dataManager.getConnection();
            if (connection != null) {
              try {
                Statement s = connection.createStatement();
                String sql = "select ID from floor order by ID asc";
                try {
                  ResultSet rs = s.executeQuery(sql);
                  try {
                    while (rs.next()) {
                      floornumbers.add(rs.getInt(1));
                  finally { rs.close(); }
                finally {s.close(); }
              catch (SQLException e) {
                System.out.println("Could not get floor numbers: " + e.getMessage());
              finally {
                dataManager.putConnection(connection);
            return floornumbers;
         }  The classes compile properly, but when I load this page up in Tomcat it just freezes and does not load the form. I tested the DB connection and it works fine.
    What am I doing wrong in the JSP code?
    Thanks for the help in advance.
    UPDATE: I commented out the form, and added <%=floornumbers.size()%> right above the commented code to check if the ArrayList is indeed getting populated with the values from the database (the values are of type integer in the database). The page still freezes like before. I'm puzzled now :confused: .

    Wrong usage of Iterator.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers();
                Iterator<Integer> iterator = floornumbers.iterator(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% while (iterator.hasNext()) {
                                    Integer inte = iterator.next();
                            %>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <% } %>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>or make use of enhanced loop as you are already using J2SE 5.0+ for avoiding confusions.
    <!-- Form for picking the floor -->
             <!-- Get the available floors -->
             <% ArrayList<Integer> floornumbers = dataManager.getAllFloorNumbers(); %>
             <!-- Create the form for users to select the floor -->
             <form id="floorselectionform">
                  <input type="hidden" name="action" value="floorselected"/> <!-- Guides the servlet to redirect to the appropriate page -->
                  Select floor | <select name="floorselector" id="floorselector">
                       <% for(Integer inte:floornumbers) {%>
                       <option value="<%=inte.intValue()%>"><%=inte.intValue()%></option>
                       <%}%>
                  </select>
                  <input type="submit" value="Go!"/>
             </form>and a lot better thing would be making usage of basic Taglib provided with JSTL spec or struts spec which make life easier and simple.
    something like usage of <c:forEach/> or <logic:iterate/> would be lot better without writing a single scriptlet code.
    Hope that might help :)
    REGARDS,
    RaHuL

  • Please help: Populating values in drop down list by onchange - javascript !

    I am working on a task - I need to populate drop down named "year" dynamically (from database) depending upon the select of an element from drop down list "carLine" . I am calling javascript funtion on onchange event of the html select and setting property of the selected element.The environment is Struts and dynaactionform is being used . Here is the my html select for both the drop down list s and javascript funtion to set value. The getYears method is defined in the locatoraction action class. But after doing all these carLine is not getting populated with the values corresponding to selected carline.
    Database side is working fine .
    <script type="text/javascript">
    function getYearsForCarline(){
    document.getElementById('method').value = 'getYears';
    document.forms[0].submit();
    alert("submitted");
    </script>
    <html:form styleId="locatorForm" action="/locator/locatorAction" method="post">
              <input type="hidden" name="method" value="getYears" />
              <tr>
                   <td align="center">
                   <table border="0" width="300" cellpadding="0" cellspacing="5">
                        <tr>
                             <td><span class="formLabelEM"><bean:message
                                  key="label.locator.carLine" />*</span>
                             <html:select styleId="carLineBox" property="carLine" onchange="javascript:getYearsForCarline()">
                                  <html:option value="">Select a Carline</html:option>
                                  <html:optionsCollection property="carLines" />
                             </html:select></td>
                        </tr>
                        <tr>
                             <td><span class="formLabelEM"><bean:message
                                  key="label.locator.modelYear" />*</span>
                             <html:select property="year" >
                             <html:option value="">Select Year</html:option>
                                  <html:optionsCollection property="years" />
    Any advise will be highly appreciated . Thanks in advance.

    Thanks both of you for the advise ! My code worked perfectly fine after adding separate action mapping for Year and using that as action in the form though the new action mapping point to the same action class locatorAction ..I still do not understand the reason behind this exactly(any suggestion are most welcome) but it works. Here is code for my action mapping :
    <action path="/locator/locatorYearAction" name="locatorForm"
                   input="/locator/locatorMain.jsp"
                   type="com.apps.sales.web.salesin.actions.LocatorAction"
                   parameter="method" validate="true">
                   <forward name="showCarlines" path="/locator/locatorMain.jsp"
                        redirect="false" />
                   <forward name="showModels" path="/locator/locatorModels.jsp"
                        redirect="false" />     
              </action>

Maybe you are looking for