How to get the values of 2 dynamic comboboxes in one jsp to another jsp?

I have 2 comboboxes and one submit button on my jsp page.I select a value in 1st combobox then the values in the second combobox populated from the database. next i select 2nd combobox and then submit the button.After submit the button call the next jsp page. In that page i want to display the values of two comboboxes. but my problem is , in that page only 2nd combobox value is displayed.1st combobox is displayed as null. plz tell me, how to get the values of two comboboxes at a time?
Select.jsp:
<%@ page language="java" import="java.sql.*" %>
<%!
     Connection con = null;
     Statement  st  = null;
     ResultSet  rs  = null;
     String     sql = null;
     void addItems(javax.servlet.jsp.JspWriter out, String sql)
       try{     
          rs = st.executeQuery(sql);
          while( rs.next() )
               out.println("<option>" + rs.getString(1) + "</option>");               
     }catch(Exception e)
               System.out.println(e);
%>
<HTML>
<HEAD>
<TITLE>JSP WITH  MULTIPLE FORMS</TITLE>
<script language="javascript">
          function checking()
                    form1.submit();
     </script>
</HEAD>
     <body>
         <center>
         <b><font size="5" color="#333399">Staff ID:</font></b></center>
                 <FORM NAME="form1" METHOD="POST" ACTION="Select.jsp">
                     <p align=center>
                     Details of Staff :  
                   <SELECT 1 NAME="type" onchange="checking();">
                                <option> Administrator </option>
                          <option> OfficeAssistent </option>
                          <option> Clerk </option>
                              </SELECT 1>
                      </p>
</FORM>
                  <FORM NAME="form2" METHOD="POST" action="welcome1.jsp">
                  <center>
                      <TABLE><TR><TD>Staff ID:</TD>
                             <TD><SELECT 2 NAME="staff_id">
                <%    
        String type = request.getParameter("type");
        try {
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        con = DriverManager.getConnection("jdbc:odbc:java","system","manager");
        catch (ClassNotFoundException ex) {
               System.out.println(ex);
        catch (SQLException ex)
            System.out.println(ex);
     st  = con.createStatement();
     sql = "select staff_id from "+type+"";
     addItems(out, sql);
%>
          </SELECT 2>
       </TD>
     </TR>
</table></center>
<h2> Details of <%= type + "s" %> </h2>
                     <center><input type=submit value=ok onclick="submit();"></center>
              </FORM>
     </BODY>
</HTML>
welcome1.jsp
<center><h1>WEL COME</h1></center>
<%    
        String type = request.getParameter("type");
        String sid = request.getParameter("staff_id");
%>
<h2> Details of <%= type + "s" %> </h2>
<h2> Details of <%= sid %> </h2>

<SELECT 1 NAME="type" onchange="checking();">
                                <option value = "0"> Administrator </option>
                          <option value = "1"> OfficeAssistent </option>
                          <option value = "2"> Clerk </option>
                              </SELECT 1>

Similar Messages

  • How to get the values of Select-options from the screen.

    The value of parameter can be obtained by function module 'DYNP_VALUES_READ' but How to get the values of Select-options from the screen? I want the F4 help values of select-options B depending on the values in Select-option A.So I want to read the Select-option A's value.

    Hi,
    Refer this following code..this will solve your problem...
    "Following code reads value entered in s_po select options and willprovide search
    "help for s_item depending upon s_po value.
    REPORT TEST.
    TABLES : ekpo.
    DATA: BEGIN OF itab OCCURS 0,
    ebelp LIKE ekpo-ebelp,
    END OF itab.
    SELECT-OPTIONS   s_po FOR ekpo-ebeln.
    SELECT-OPTIONS s_item FOR ekpo-ebelp.
    INITIALIZATION.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_item-low.
      DATA:
      dyn_field TYPE dynpread,
      temp_fields TYPE TABLE OF dynpread,
      zlv_dynpro TYPE syst-repid.
      zlv_dynpro = syst-repid.
      CALL FUNCTION 'DYNP_VALUES_READ'
        EXPORTING
          dyname     = zlv_dynpro
          dynumb     = syst-dynnr
          request    = 'A'
        TABLES
          dynpfields = temp_fields
        EXCEPTIONS
          OTHERS     = 0.
      LOOP AT temp_fields INTO dyn_field.
        IF dyn_field-fieldname EQ 'S_PO-LOW'.
            SELECT * INTO CORRESPONDING fields OF TABLE itab FROM ekpo
            WHERE ebeln EQ dyn_field-fieldvalue.
            EXIT.
        ENDIF.
      ENDLOOP.

  • How to get the values from popup window to mainwindow

    HI all,
       I want to get the details from popup window.
          i have three input fields and one search button in my main window. when i click search button it should display popup window.whenever i click on selected row of the popup window table ,values should be visible in my main window input fields.(normal tables)
       now i am able to display popup window with values.How to get the values from popup window now.
       I can anybody explain me clearly.
    Thanks&Regards
    kranthi

    Hi Kranthi,
    Every webdynpro component has a global controller called the component controller which is visible to all other controllers within the component.So whenever you want to share some data in between 2 different views you can just make it a point to use the component controller's context for the same. For your requirement (within your popups view context) you will have have to copy the component controllers context to your view. You then will have to (programmatically) fill this context with your desired data in this popup view. You can then be able to read this context from whichever view you want. I hope that this would have made it clear for you. Am also giving you an [example|http://****************/Tutorials/WebDynproABAP/Modalbox/page1.htm] which you can go through which would give you a perfect understanding of all this. In this example the user has an input field in the main view. The user enters a customer number & presses on a pushbutton. The corresponding sales orders are then displayed in a popup window for the user. The user can then select any sales order & press on a button in the popup. These values would then get copied to the table in the main view.
    Regards,
    Uday

  • How to get the value from a JavaScript and send the same to Java file?

    Hi.
    How to get the value from a JavaScript (this JS is called when an action invoked) and send the value from the JS to a Java file?
    Thanks and regards,
    Leslie V

    Yes, I am trying with web application.
    In the below code, a variable 'message' carries the needed info. I would like to send this 'message' variable with the 'request'.
    How to send this 'message' with and to the 'request'?
    Thanks for the help :-)
    The actual JS code is:
    function productdeselection()
    var i=0;
    var j=0;
    var deselectedproduct = new Array(5);
    var message = "Are you sure to delete Product ";
    mvi=document.forms[0].MVI;
    mei=document.forms[0].MEI;
    lpi=document.forms[0].LPI;
    if(null != mvi)
    ++i;
    if(null != mei )
    ++i;
    if(null != lpi)
    ++i;
    if(null != mvi && mvi.checked)
    deselectedproduct[++j]="MVI?";
    if(null != mei && mei.checked)
    deselectedproduct[++j]="GAP?";
    if(null != lpi && lpi.checked)
    deselectedproduct[++j]="LPI?";
    if( 0!=j)
    if(i!=j)
    for (x=0; x<deselectedproduct.length; x++)
    if(null != deselectedproduct[x])
    message =message+ "-" +deselectedproduct[x];
    alert(message);
    else
    //alert(" You cannot remove all products!");
    return false;
    return true;
    }

  • How to get the value from databank

    Hi,
    How to get the value from databank? and how to set the same value to visual script object?
    thanks,
    ra

    Hi,
    You can use GetDatabankValue(HeaderName, Value) to get the value from databank and SetDataBankValue(HeaderName, Value) to set the value to databank.
    You can refer to the API Reference to see list of associated functions and techniques we can use with related to Data Bank.
    This is the for OFT but if you are using Open Script then you have direct access for getting the databank value but when it comes to setting a value you have to use File operation and write you own methods to do the set operation.
    Thanks
    Edited by: Openscript User 100 on Nov 13, 2009 7:01 AM

  • How to get the values from html:select? tag..?

    i tried with this, but its not working...
    <html:select styleClass="text" name="querydefs" property="shortcut"
                 onchange="retrieveOptions()" styleId="firstBox" indexed="true">
    <html:options collection="advanced.choices" property="shortcut" labelProperty="label" />
    </html:select>
                        <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>

    <td align="left" class="rowcolor1">
                        <script language="javascript" type="text/javascript">
                              function retrieveOptions(){
                             var sel = document.querydefs.options;
                             var selectedOption = sel[sel.selectedIndex].value;
                             document.write(selectedOption);
                           </script>This java script is not working at all..its not printing anything in document.write();
    This is code..
    <td class="rowcolor1" width="20%">
    <html:select styleClass="text" name="querydefs" property="shortcut"
                             onchange="retrieveSecondOptions()" styleId="firstBox"
                             indexed="true">
                             <html:options collection="advanced.choices" property="shortcut"
                                  labelProperty="label"  />
                        </html:select>i tried with this also. but no use..i'm not the getting the seleced option...
    function retrieveOptions(){
    firstBox = document.getElementById('firstBox');
                             if(firstBox.selectedIndex==0){
          return;
        selectedOption = firstBox.options[firstBox.selectedIndex].value;
    }actually , how to get the values from <html:select> ...?
    my idea is to know which value is selected from the combo box(<html:select> ) if that value is equal some string i have enable a hyperlink to open a popup window

  • How to get the values from IDXML during a Pre processing

    Hi,
    I have a requirement to validate the attributes in the IDXML request while deactivating a user. I have configured a workflow with the steps "Initiate" "Externalaction" "Disable" "Commit".
    The following is my IDXML request. I want to get the values that is coming in the IDXML in the pre action (written a c++ plugin) and perform certain validations.
    <?xml version="1.0"?>
    <SOAP-ENV:Envelope
                             xmlns:SOAP-ENV="http://schemas-xmlsoap.org/soap/envelope/"
                             xmlns:oblix="http://www.oblix.com">
    <SOAP-ENV:Body>
         <oblix:authentication xmlns:oblix="http://www.oblix.com" type="basic">
              <oblix:login>adminuser</oblix:login>
              <oblix:password>password1</oblix:password>
         </oblix:authentication>
         <oblix:request application="userservcenter" function="workflowDeactivateUserSave">
         <oblix:params>     
              <oblix:param name="ObWorkflowName">obworkflowid=9bbb88b273b1012d000086E812d695ad,obcontainerId=workflowDefinitions,o=Oblix,dc=dnb,dc=com</oblix:param>          
              <oblix:param name="uid">[email protected],ou=dnbCustomers,ou=People,dc=dnb,dc=com</oblix:param>
              <oblix:param name="attrName_1">UserID</oblix:param>
              <oblix:param name="attrValue_1">[email protected]</oblix:param>
              <oblix:param name="attrValue_1_old">[email protected]</oblix:param>
              <oblix:param name="attrOperation_1">REPLACE</oblix:param>
              <oblix:param name="attrName_2">ApplicationID</oblix:param>
              <oblix:param name="attrValue_2">12345611</oblix:param>
              <oblix:param name="attrValue_2_old">123456</oblix:param>
              <oblix:param name="attrOperation_2">REPLACE</oblix:param>
              <oblix:param name="attrName_3">SubscriberNum</oblix:param>
              <oblix:param name="attrValue_3">09787655</oblix:param>
              <oblix:param name="attrValue_3_old">09787655</oblix:param>
              <oblix:param name="attrOperation_3">REPLACE</oblix:param>
              <oblix:param name="noOfFields">3</oblix:param>
         </oblix:params>
         </oblix:request>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    How to get the values "ApplicationID","SubscriberNum" inside the preaction hook (c++). Please provide suggestions.
    Thanks,
    Lakshmi

    Read the doc, write the code, test it and debug it . http://download.oracle.com/docs/cd/E15217_01/doc.1014/e12491/idapi.htm#CDEIDDAF

  • How to get the values from profileFormHandler

    Hi,
    here i have problem with how to get the values after setting the values to that , how i have to call repository, what repository i've to call?

    When you are setting values, check the repository(getRepository()) from which mutable repository item is created. Go to that class .properties file and check the repository mapping.
    -karthik

  • How to get the values from repeated frame?.

    Hi
    how to get the values from repeated frame?. i have to disply the first 3 digits in another place in my report.
    i have field empno in repeated frame and i want to disply first 3 digits in another place in the same report.
    thanks

    How often do you need to display it? It sounds like you might want to base a summary on that formula with a function of first or last. If it's a per page basis, it can be a page level summary. If it's at a higher level repeating frame, then you can create the summary at that level. I'd suggest taking a look at the online help for summaries using the first/last functions.
    Hope that helps,
    Toby

  • How to get the values of all elements and sub elements from  following xml

    how to get the values of all elements and sub elements from following xml...
    <?xml version="1.0" encoding="UTF-8" ?>
    <List_AML_Finacle xmlns="http://3i-infotech.com/Cust_AML_Finacle.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://3i-infotech.com/Cust_AML_Finacle.xsd List_AML_Finacle.xsd">
    <TransactionID>TransactionID</TransactionID>
    <Match>
    <Src_Matched_Field>Src_Matched_Field</Src_Matched_Field>
    <List_Matched_Field>
    <FSFM_Matches>
    <NUMBER>NUMBER</NUMBER>
    <TERROR>TERROR</TERROR>
    <TU>TU</TU>
    <NAMEU>NAMEU</NAMEU>
    <DESCRIPT>DESCRIPT</DESCRIPT>
    <KODCR>KODCR</KODCR>
    <KODCN>KODCN</KODCN>
    <AMR>AMR</AMR>
    <ADDRESS>ADDRESS</ADDRESS>
    <SD>SD</SD>
    <RG>RG</RG>
    <ND>ND</ND>
    <VD>VD</VD>
    <GR>GR</GR>
    <YR>YR</YR>
    <MR>MR</MR>
    <CB_DATE>CB_DATE</CB_DATE>
    <CE_DATE>CE_DATE</CE_DATE>
    <DIRECTOR>DIRECTOR</DIRECTOR>
    <FOUNDER>FOUNDER</FOUNDER>
    <TERRTYPE>TERRTYPE</TERRTYPE>
    </FSFM_Matches>
    <OfacMatchDetails>
    <UID>UID</UID>
    <TITLE>TITLE</TITLE>
    <SDNTYPE>SDNTYPE</SDNTYPE>
    <REMARKS>REMARKS</REMARKS>
    <ID_UID>ID_UID</ID_UID>
    <IDTYPE>IDTYPE</IDTYPE>
    <IDNUMBER>IDNUMBER</IDNUMBER>
    <IDCOUNTRY>IDCOUNTRY</IDCOUNTRY>
    <ISSUEDATE>ISSUEDATE</ISSUEDATE>
    <EXPIRATIONDATE>EXPIRATIONDATE</EXPIRATIONDATE>
    <ADDRESS1>ADDRESS1</ADDRESS1>
    <ADDRESS2>ADDRESS2</ADDRESS2>
    <ADDRESS3>ADDRESS3</ADDRESS3>
    <CITY>CITY</CITY>
    <STATEORPROVINCE>STATEORPROVINCE</STATEORPROVINCE>
    <POSTALCODE>POSTALCODE</POSTALCODE>
    <COUNTRY>COUNTRY</COUNTRY>
    </OfacMatchDetails>
    </List_Matched_Field>
    </Match>
    </List_AML_Finacle>

    avoid multi post
    http://forum.java.sun.com/thread.jspa?threadID=5249519

  • How to get the values and attributes of Longlived processes by using ProcessID.

    Hi Experts,
    For  every process we creates, LC ES2 creates processID.
    we know that if you creates  a long lived process, all  the  values which are in proces will be stored some where  in DB.
    Here my requirement is by using  processID I need to get all/some values/variables stored in database.
    I am not able to get values using processID. Here I don't have clue on  how to get the values.
    Please tell me  how to get the same by using  Process Management. Link/guide would be helpful
    Thanks
    Praveen.

    Searchable means you can put a filter criteria on it (e.g. where amount > 50000)
    Visible means you can add have this column returned as an output (and therefore you can add it as column in listview and see it in Task Details).
    These two attributes were provided so that queries could be done against the process variables, but the exact contents of the variables are not allowed to be seen.

  • How to get the values of the objects inside an object??

    Hi,
    I am trying to write code to display name and memory usage of all session attributes, in a recursive way.
    I suppose reflection is needed here, but I can’t figure out how to get the values of the objects inside an object...
    private void handleIt(String attributeName, Object attributeValue) {
         boolean isPrimitiveOrNull = ((null == attributeValue) ||
              (attributeValue.getClass().isPrimitive()));                                         
         if (isPrimitiveOrNull) {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
         } else {
              sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
              Field[] fields = attributeValue.getClass().getDeclaredFields();
              int lim = fields.length;
              String name;
              Object value = null;
              for (int i = 0; i < lim; i++) {
                   name = fields.getName();
                   //LOOK AT THIS LINE: !!!!!!!!!!!!!!!!!!!!!!!!!!!
                   value = fields[i].get(obj); //I don´t know what 'obj' should be??
                   handleIt(name, value);
              sb.append("}");               
    Any suggestions will be greatly appreciated...

    I realized that massive int objects called MAX_VALUE, MIN_VALUE and SIZE where causing the StackOverflow, so I removed them from the analysis.
    This is the resultant code. But I think it isn’t accurate in calculating the real size of objects being got using reflexion.
    Do you or somebody have any more suggestions?
    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.ObjectOutputStream;
    import java.lang.reflect.Field;
    import java.util.Enumeration;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    public class SessionMeasurer extends HttpServlet {
         private static final long serialVersionUID = 1470488362727841992L;
         private StringBuilder sb = new StringBuilder();
         public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              performTask(request, response);
         public void performTask(HttpServletRequest request, HttpServletResponse response) {
              HttpSession     session = request.getSession(false);     
              String attributeName = "";
              Object attributeValue = null;
              for (Enumeration<?> attributeNames = session.getAttributeNames(); attributeNames.hasMoreElements();) {
                   attributeName = (String)attributeNames.nextElement();
                   attributeValue = session.getAttribute(attributeName);
                   handleIt(attributeName, attributeValue);               
              System.out.println(sb.toString());
         private void handleIt(String attributeName, Object attributeValue) {           
              if (attributeValue != null) {          
                   boolean isPrimitive = attributeValue.getClass().isPrimitive();
                   if (isPrimitive) {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "}");
                   } else {
                        sb.append("{" + attributeName + ":" + sizeOf(attributeValue) + "{");               
                        Field[] fields = attributeValue.getClass().getDeclaredFields();
                        String name;
                        Object value = null;
                        int lim = fields.length;
                        for (int i = 0; i < lim; i++) {
                             name = fields.getName();                                                                                                         
                             if (!name.endsWith("_VALUE") && !name.equals("SIZE") && !name.equals("serialVersionUID")) {
                                  try {
                                       value = fields[i].get(attributeValue);
                                  } catch(Exception e) {
                                       //PENDIENTE: Tratamiento excepción
                                  handleIt(name, value);
                        sb.append("}");               
         private int sizeOf(Object obj) {
              //Valid only for Serializables
              ByteArrayOutputStream baos = new ByteArrayOutputStream();
              ObjectOutputStream oos = null;     
              byte[] bytes = null;               
              try {          
                   oos = new ObjectOutputStream(baos);
                   oos.writeObject(obj);
                   bytes = baos.toByteArray();
              } catch(Exception e) {               
                   //PENDIENTE: Tratamiento excepción
              } finally {
                   if (oos != null) {
                        try {
                             oos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
                   if (baos != null) {
                        try {
                             baos.close();
                        } catch(Exception e) {
                             //PENDIENTE: Tratamiento excepción                         
              int size = -1;
              if (bytes != null) {
                   size = bytes.length;
              return size;          

  • How to get the value of a variable defined in javascript in JSP

    how to get the value of a variable defined in javascript in/through JSP????

    In Javascript you can use the DOM to access the input element and set it's value before submitting the form. Then it's value will just be passed.

  • How to get the value of a variable in FOX?

    Hi,
    In the FOX program how to get the value of a variable defined in planning area?
    can anyone give me some sample code?
    thanks

    Adding to the last reply,
    you can use VARI(variable) to get the count of the values.
    In the latest version of BPS, you may also use the following new foreach construct:
    FOREACH var IN VARIABLE  variable_id.
    Regards - Ravi

  • A^b = n ,How to get the value for a ?

    a^b = n ===> n = Math.pow(a,b)
    How to get the value for a ?
    dose Java have API to get the value for a ?
    Thanks for help~~~

    a^b = n
    =>
    a = n^(1/b)
    So,
    a = Math.pow(n,1.0/b)

Maybe you are looking for

  • Solaris patching on solaris 10 x86

    just wondering if anyone can assist. i have just installed solaris 10 x86 recommended patches on a 16 disks server. where first 2 disks are mirrored called rpool, and remaining 14 disks are raid z called spool. upon installing the patches successfull

  • Import from a sample.DMP file ????? hlp???

    when import from a dump file an error occurs>>>>>> Export file created by export:v10.01.00 via conventional path IMP-00013: only a DBA can import a file exported by another DBA IMP-00000: Import terminated unsuccessfully. What can i do .... help meee

  • Aggregate Functionality

    I have a requirement. First let me explain briefly the data we have: 1. There is an org heirarchy and we have around 8000 employees and every employee reports to 1 supervisor on a given day 2. An Employee can be tied to a transaction on a given day 3

  • Load balancing in the process chains

    HI friends I have 6 subchains in 1 metachain . we are facing a problem  where we have to 2 servers . but when we run the process chains they are  occuping all the DIA process  in only one server . the other server is empty . so is there a way  that w

  • Running Time and Connected Noises

    I am wondering if there is a maximum time limit I should run my laptop, because it gets really hot on the bottom and today it is making funny humming noises like something behind the speakers is vibrating. I think that it's because I used it to aggre