none
Loop through Textbox in JSP RRS feed

  • Question

  • How do i send the consolidated data  back to the Servlet? On clicking the submit value only the most recent data gets sent to the Servlet. 

    <script type="text/javascript">
     function addNew()
      {
        var i = 1;
        my_div.innerHTML = my_div.innerHTML +"<br><br><label>Week Number</label><input type='text' name='mytext'+ i><br><br><label>Sensor Number</label><input type='text' name='mytext'+ i><br><br><label>Time On</label><input type='text' name='mytext'+ i><br>"
      }
    </script>
    </head>
    <body>
    <div id="header">
     <h2>Behavior Change Detection</h2>
    </div>
    <div id="content">
    Enter Sensor Information<br><br>
    <form name="form"  action = "http://localhost:8080/Trail/SensorServlet" method="post">
    <label>Week Number</label>
    <input type="text" name=week required><br><br>
    <label>Sensor Number</label>
    <input type="text" name=sensorNumber required><br><br>
    <label>Time On</label>
    <input type="text" name=timeOn required><br><br>
    <input type="button" value="Add" onClick="addNew()">
    <div id="my_div"></div><br>
    <div style="text-align: left"> 
    <a href="sensor.jsp"><input type ="submit" value="Submit"></a>
    <div class="divider"/>
    <a href="home.jsp"><input type="button" name="cancel" value="Cancel" /></a>

    • Moved by Stanly Fan Thursday, April 26, 2018 8:34 AM
    Sunday, April 22, 2018 3:15 PM

All replies

  • Hi,

    According to your description, your issue is more related about ASP.NET. And this forum is discussing and asking questions about the Windows Form and ClickOnce, it will be more appropriate to ask your question at ASP.NET Forum.

    Thank you for your understanding.

    Regards,

    Frankie


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, April 23, 2018 6:08 AM
  • How do i send the consolidated data  back to the Servlet? On clicking the submit value only the most recent data gets sent to the Servlet. 

    <script type="text/javascript">
     function addNew()
      {
        var i = 1;
        my_div.innerHTML = my_div.innerHTML +"<br><br><label>Week Number</label><input type='text' name='mytext'+ i><br><br><label>Sensor Number</label><input type='text' name='mytext'+ i><br><br><label>Time On</label><input type='text' name='mytext'+ i><br>"
      }
    </script>
    </head>
    <body>
    <div id="header">
     <h2>Behavior Change Detection</h2>
    </div>
    <div id="content">
    Enter Sensor Information<br><br>
    <form name="form"  action = "http://localhost:8080/Trail/SensorServlet" method="post">
    <label>Week Number</label>
    <input type="text" name=week required><br><br>
    <label>Sensor Number</label>
    <input type="text" name=sensorNumber required><br><br>
    <label>Time On</label>
    <input type="text" name=timeOn required><br><br>
    <input type="button" value="Add" onClick="addNew()">
    <div id="my_div"></div><br>
    <div style="text-align: left"> 
    <a href="sensor.jsp"><input type ="submit" value="Submit"></a>
    <div class="divider"/>
    <a href="home.jsp"><input type="button" name="cancel" value="Cancel" /></a>

    This is not issue with Microsoft tencology. Not clear what you are after, but i guess you may need to use SessionState on the server side to keep state between web requests (cookies or URL marshalling may be used under the hood on the cliente side), i suggest use of a fórum for Java Server Pages comunity, like https://coderanch.com/f/50/JSP.

    Good luck.

    Thursday, April 26, 2018 11:44 AM