How to Get the values from Dynamic jasp page

Hi,
I have a jsp form page wherein i input the data form the user and get these values on the action servlet.
But now i have added a feature to Add and Delete the Elements using javascript and this creates a dynamic form on the jsp page. I want to Get the values of these all elements at the Action servet.
Please suggest the solution.
Thanks,
JavaQueue

getParameterMap() returns a Map[1] with all parameters; the parameter name is the key and the value is the value of the parameter in the form of String arrays.
You have to iterate over the Map and get values as you see fit. Search for a tutorial/ example/ sample for using Maps. I'm sure you'll find loads that will do a better job at explaining.
[1] http://java.sun.com/j2se/1.4.2/docs/api/java/util/Map.html
People on the forum help others voluntarily, it's not their job.
Help them help you.
Learn how to ask questions first: http://faq.javaranch.com/java/HowToAskQuestionsOnJavaRanch
----------------------------------------------------------------

Similar Messages

  • 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 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 from a html form embedded in a swing container

    Hi all,
    I am developing an application in which i have to read a html file and display it in a swing container.That task i made it with the help of a tool.But now i want to get the values from that page.ie when the submit button is clicked all the values of that form should be retrived by a servlet/standalone application.I don't know how to proceed further.Any help in this regard will be very greatful
    Thanks in advance,
    Prakash

    By parsing the HTML.

  • How to get the value from a servlet?

    Hello guys:
    how can i get the value from a servlet on my jsp page,for example return a boolean variable from a servlet
    which API to use?
    thanks

    Hi
    There is no specific API for this, call the method of the servlet which returns the required value in your JSP page.
    Thanks
    Swaraj

  • 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 value from a database without submitting a jsp page

    I have a jsp which has a text box depending on the value entered I want to get the value from a database for other two fields with out submitting jsp page. I am using struts.
    Thanks For any assistance provided.

    Alright,here is an example for you for the first case.
    Present.jsp:
    ============
    <html:html>
    <head>
    <title><html:message key="page.title"/></title>
    </head>
    <body>
    <html:form action="ChangeEvent.do">
    <html:hidden property="method"/>
    <!-- Submitting the Form onKeyUp of EmpId field and trying to save the
         state of the Form in the scope of session -->
    Emp Id:<html:text property="empId" size="5"  onkeyup="if(true){this.form.elements[0].value='populateDetails';this.form.submit();}"/>
    Emp Name:<html:text property="empName" size="10" />
    Email Address:<html:text property="email" size="10" />
    <html:submit>Submit</html:submit>
    </html:form>
    </body>
    </html:html>struts-config.xml:
    ==================
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <!-- Form bean which stores the properties of all the Form elements -->
    <form-beans>
    <form-bean name="employeeFormBean" type="org.apache.struts.action.DynaActionForm">
       <form-property name="empId" type="java.lang.String"/>
       <form-property name="empName" type="java.lang.String"/>
       <form-property name="email" type="java.lang.String" />   
    </form-bean>
    </form-bean>
    <action-mappings>
    <action path="/ChangeEvent" type="Test.GetChangeAction" name="employeeFormBean" scope="request" parameter="method"> 
    <!-- On successful call of DB the Page has to be forwarded to the same page again by
          uploading updated form bean values. -->
    <forward name="success" path="/Present.jsp"></forward>
    <forward name="failed" path="/error.jsp"></forward>
    </action>
    </action-mappings>
    </struts-config>GetChangeAction.java:
    =====================
    public class GetChangeAction extends DispatchAction{
      public ActionForward populateDetails(ActionMapping mapping,ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
            DynaActionForm dForm = (DynaActionForm)form;
            String empId = dForm.get("empId");     
            // calling Model / Db and then getting back Employee Details
            EmployeeBean eb = ModelUtils.getDetails(empId);
            // Updating form bean by updating values from the Model 
            dForm.set("empName".eb.getEmpName()); 
            dForm.set("email".eb.getEmail());
            return mapping.findForward("success");
    }well to me this should work regardless to any browser but we need to make sure we put in our logic properly.

  • How to get the value from the checkbox

    Hi All,
    Good Evening,
    i want to get the value from the check box.
    for this i wrote like this
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String val=cbb.getvalue(pageContext).toString();
    val getting the value only when checkbox is checked.
    suppose check box is not checked that time i got NULL POINTER exceptionn.
    so
    i tried the following way alsoo
    string val=pageContext.getParameter("item240");
    here val return 'on' only when checkbox is checked.
    otherwise NULL value returnss.
    but i want to get the value is 'Y' when i am checked the checkbox
    otherwise returns NULL valuee.
    already i set the checkbox properties alsoo
    Checked :Y
    unchecked:N
    pls tell me

    Hi,
    use
    try
    OAMessageCheckBoxBean cbb=(OAMessageCheckBoxBean)webBEan.findChildRecurssive("item240")
    String test = cbb.getvalue(pageContext).toString();
    catch(Exception e)
    String test = "";
    this way you can handle null pointer exception.
    Thanks,
    Gaurav

  • How to get the values from struct data type using java code..?

    Hi ,
    I am newer to java.
    we are using oracle database.
    How to get the data from struct data type using java code.
    Thanks in Advance.
    Regards,
    kumar

    Hi Rajeev,
    To retrieve a FilterContainer you will need to traverse the report structure:
    ReportStructure boReportStructure = boDocumentInstance.getStructure();
    ReportContainer boReportContainer = (ReportContainer) boReportStructure.getReportElement(0);
    FilterContainer boFilterContainer = null;
    if (boReportContainer.hasFilter()) {
         boFilterContainer = boReportContainer.getFilter();
    } else {
         boFilterContainer = boReportContainer.createFilter(LogicalOperator.AND);
    Calling boDocumentInstance.getStructure() will retrieve the entire structure for the document.
    Calling boReportStructure.getReportElement(0) will retrieve the structure for the first report of the document.
    Hope this helps.
    Regards,
    Dan

  • 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 value in one JSP page to another?

    Hi,
    I have problems in passing the value around in JSP. I have two JSP pages as below:
    test1.jsp
    I try to get the vaule from my textbox by using:
    String strUser = request.getParameter ("strUserName");
    Then i print out by using: out.print(strUser); then i can get the value and put on my page (For example, i get ABC on my page).
    test2.jsp
    Next, i want to get the value from strUser (which mean that the one i already display on page in test1.jsp, ABC) to insert into my table by using INSERT INTO statement. Then i try by using
    String strUser1 = request.getParameter ("strUser");
    Is it possbile for me to do that? I cannot get anything to insert into my table. Then i tried out.print(strUser1); then i found that i get NULL value.
    Could you please give me some guidance?
    Thanks you very much for any advise you may give me.
    Kimsan

    Hi,
    Thank you very much for your help. It's working fine if i just get a one value to another page, however, i have problem while i pass the value in my loop to another page because i always get the last record. I try with the following code:
    logged_page.jsp
    <html>
    <head>
    <title>Welcome to the online Auction...</title></head>
    <body>
    <%@ page language ="java" import = "java.io.*, java.lang.*, java.sql.*" %>
    <% try
         String strUsername = request.getParameter("username");
         session.setAttribute("myUserName", strUsername);     
         String strPassword = request.getParameter("password");
         Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection myConn = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/Auction/Auction.mdb");
         String strSQL = "SELECT [UserName], [Password] FROM tblUserDetails where [UserName] = ? and [Password] = ?";
         PreparedStatement statement = myConn.prepareStatement(strSQL);
         statement.setString(1, strUsername);
         statement.setString(2, strPassword);
         ResultSet myResult = statement.executeQuery();
         if(myResult.next())
         //out.println("Login Succesful! A record with the given user name and password exists");
         out.print("<center><h1>");
         out.print("Welcome  ");
         out.print(strUsername);
         out.print("</h1></center>");
         out.print("<center>");
         out.print("<BR><BR>");
         out.print("<font font face = Viner Hand ITC size= 5>Products on sales</font>");
         out.print("<BR><BR>");
         Statement myStatement = myConn.createStatement ();
         ResultSet myResult1 = myStatement.executeQuery("SELECT * FROM tblProduct");
         ResultSetMetaData myResultSet = myResult1.getMetaData();
         out.println("<font face=Tahoma>");
         out.print("<table border=1 CELLSPACING=0>");
         out.print("<TR>");
         out.print("<TD width = 200> Item Title");out.print("</TD>");
         out.print("<TD width = 200> Description");out.print("</TD>");
         out.print("<TD width = 200> Current bid");out.print("</TD>");
         out.print("<TD width = 200> Available Time");out.print("</TD>");
         out.print("<TD width = 200> Place Bid");out.print("</TD>");
         out.print("</TR>");
         out.print("</table>");
         while(myResult1.next())
              String strProName = myResult1.getString(1);
              session.setAttribute("myProName", strProName);          
              out.print("<table border=1 CELLSPACING=0>");
              out.print("<TR>");
              out.print("<TD width = 200>");
              out.println(strProName);
              out.print("</TD>");
              out.print("<TD width = 200>");
              out.println(myResult1.getString(3));
              out.print("</TD>");
              out.print("<TD width = 200>");
              out.println(myResult1.getString(2));
              out.print("</TD>");
              out.print("<TD width = 200>");
              out.println(myResult1.getString(4));
         out.print("</TD>");
         out.print("<TD>");
              out.print("<form action=bid_page.jsp method=post>");
              out.print("<input type=text name=place_bid>");
              out.print("<input type=submit name=okfunc value=Bid>");
              out.print("</TD>");
              out.print("</form>");
              out.print("</TR>");
              out.print("</table>");
              out.println("</font>");
              out.print("</center>");          
         else
              out.print("<center>");
              out.print("Sorry ");
              out.print("<font color = RED size = 5>");
              out.print(strUsername);
              out.print("</font>");
              out.print(" could not be found.");
              out.print("</center>");
         myResult.close();
         statement.close();
         myConn.close();
         catch(SQLException e)
         out.println(e);
    %>
    </body>
    </html>
    bid_page.jsp
    <HTML>
    <HEAD>
    <TITLE>Welcome to the online Auction...</TITLE>
    </HEAD>
    <BODY>
    <%@ page language ="java" import = "java.io.*" import = "java.lang.*" import = "java.sql.*" %>
    <% try
         String thisUserName = (String) session.getAttribute("myUserName");
         String thisProName = (String) session.getAttribute("myProName");
              Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
         Connection myConn = DriverManager.getConnection("jdbc:odbc:Driver={MicroSoft Access Driver (*.mdb)};DBQ=C:/Auction/Auction.mdb");
         PreparedStatement myStatement = myConn.prepareStatement("INSERT INTO tblHistory VALUES ('"+thisUserName+"', '"+thisProName+"', '"+request.getParameter("place_bid")+"')");
              myStatement.executeUpdate();
              myConn.commit();
              myStatement.close();
              myConn.close();
              catch(Exception e){}
    %>
    </BODY>
    </HTML>
    When i click on the BID button in the logged_page.jsp then i always get the last record and save into my table and that is not what i want to. i want to get the result on the same row as the BID button that just click and save to my table.
    Could you please advise?
    Thanks you very much for your time and any consideration you may give me.
    Best Regard,
    Kimsan

  • How to get the value from select tag

    I am trying to do the exactly same thing as this select Demo does. I can not find out a way to get the value form the first select menu and use it to get all the values to form the second select menu.
    here is the web: http://www.4al.pl/phpAjaxTags/ . I am trying to do the same thing as the first demo shows!
    Here is part of my code:
            <!-->create the database connection <-->
            <%
            //Load the MySql Driver.
              Class.forName("com.mysql.jdbc.Driver");
              String url = "jdbc:mysql://localhost:3306/JunkDB";
              java.sql.Connection con = java.sql.DriverManager.getConnection(url, "", "");
              java.sql.ResultSet rsMake = con.createStatement().executeQuery("SELECT DISTINCT make FROM make_and_model ORDER BY make");
              String strMake= "";%>
            <!--Display the make list-->  
            <html:select property="make" value="make" size="1" name="make">
            <html:option value="---Select a Make ----"></html:option>
            <%while (rsMake.next()) {
              strMake = rsMake.getString("make");
              System.out.println("\tmake= " + strMake );%>
            <html:option value="<%=strMake.toString()%>"></html:option>       
            <%} //end while loop
            //<!--Display the model list-->%>  
            </html:select>
            <html:select property="model" value="model" size="1" name="model">
            <html:option value="---Select a model ----"></html:option>
            <%java.sql.ResultSet rsModel = con.createStatement().executeQuery("SELECT model FROM make_and_model WHERE make='" + strMake //I want to put the value of the MAkE over here so I can get the models form database+ "' ORDER BY model");%>
            <%while (rsModel.next()) {
              String strModel = rsModel.getString("model");
              System.out.println("\tmodel= " + strModel );%>
              <html:option value="<%=strModel.toString()%>"></html:option>
            <%} //end while loop
            con.close();
            System.out.println("connection closed");%>
            </html:select>
                <p><input id="notify" name="notify" class="notify" size="24" disabled="disabled" type="text"></p>
            <hr><br>
            </html:form>So how can I get the value of "make" so I can get all models for this kind of "make" ??
    Am I doing it right ??? Or I am going to a wrong direction ???
    Thanks for any input . I am new with JSP and struts

    Hi Sakthi,
    Yo can use the Java script for that..
    Dynamically the value will come into text box.
    Use the below script.
    <script type="text/javascript">
    function disFormItems()
    var lReturn = $v(here your select list name)
    alert(lReturn);
    document.getElementById(here your text box name).value =lReturn; }
    </script>Cheers,
    Shan

Maybe you are looking for