Re: JSP form submit does not overwrite request parameter value

Discussion in 'Java' started by zalla rouge, Sep 2, 2003.

  1. zalla rouge

    zalla rouge Guest

    "Adam Lipscombe" <> wrote in message news:<bj1pa8$e9b$>...
    > Folks,
    >
    >
    > I have a JSP that contains a form with some input fields. This JSP is called
    > and passed a parameter in the request object.
    >
    > i.e. http://<page_url>?myparam=abc
    >
    >
    > One of the input fields in the form has the name as the paramter.
    >
    > i.e. <input name="myparam" .......>
    >
    >
    > Howecer, when the form is submitted the original value that in the request
    > "myparam" parameter does not get overwritten by the value that is entered
    > into the input field.
    >
    > Is this behaviour correct? I would have expected that the input field value
    > would overwrite the original "myparam" value...
    >
    >
    >
    > TIA - Adam


    Hi Adam,
    try to capture the parameter value in a scriptlet
    <%
    Enumeration names = request.getParameterNames();
    //assume there is only one parameter
    while (names.hasNext()) {
    String curVal = (String) names.nextValue();
    }
    String param_value = request.getParameters(curVal);

    %>
    .....<input type="type" name=<%=currVal%> value=<%=param_value%>>....
     
    zalla rouge, Sep 2, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VisionSet
    Replies:
    1
    Views:
    4,208
    Adam Lipscombe
    Sep 2, 2003
  2. Guest
    Replies:
    2
    Views:
    1,674
    Guest
    Oct 25, 2004
  3. Megha Vishwanath
    Replies:
    3
    Views:
    804
    Megha Vishwanath
    Jul 20, 2004
  4. Florian Loitsch
    Replies:
    11
    Views:
    264
    Michael Winter
    Mar 15, 2005
  5. Replies:
    3
    Views:
    795
Loading...

Share This Page