Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: JSP form submit does not overwrite request parameter value

Reply
Thread Tools

Re: JSP form submit does not overwrite request parameter value

 
 
VisionSet
Guest
Posts: n/a
 
      09-02-2003

"Adam Lipscombe" <(E-Mail Removed)> wrote in message
news:bj1pa8$e9b$(E-Mail Removed)...
>
> 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...


Yes, multiple values of the same parameter name are allowed, this is how
multiple selection SELECT inputs pass their choosen ones. There is no
clever mechanism to distinguish between inputs that can only have one value.

If you look at the HttpServletRequest interface docs you will see:

public java.lang.String[] getParameterValues(java.lang.String name)
Returns an array of String objects containing all of the values the given
request parameter has, or null if the parameter does not exist.
If the parameter has a single value, the array has a length of 1.

--
Mike W


 
Reply With Quote
 
 
 
 
Adam Lipscombe
Guest
Posts: n/a
 
      09-02-2003
Cool. Many thanks for enlightening me....

Adam.



"VisionSet" <(E-Mail Removed)> wrote in message
news:6Z_4b.4066$(E-Mail Removed)...
>
> "Adam Lipscombe" <(E-Mail Removed)> wrote in message
> news:bj1pa8$e9b$(E-Mail Removed)...
> >
> > 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...

>
> Yes, multiple values of the same parameter name are allowed, this is how
> multiple selection SELECT inputs pass their choosen ones. There is no
> clever mechanism to distinguish between inputs that can only have one

value.
>
> If you look at the HttpServletRequest interface docs you will see:
>
> public java.lang.String[] getParameterValues(java.lang.String name)
> Returns an array of String objects containing all of the values the given
> request parameter has, or null if the parameter does not exist.
> If the parameter has a single value, the array has a length of 1.
>
> --
> Mike W
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
submit 1 form to 2 servers or 2 forms to 2 server (1 form each) on 1 submit abansal.itp@gmail.com Javascript 3 06-23-2007 07:29 AM
does a "parameters"-parameter overwrite the "parameters"-object? Florian Loitsch Javascript 11 03-15-2005 03:33 PM
Form submit - hitting enter does not trigger Submit button ASP General 2 10-25-2004 03:37 PM
STRUTS-<html:submit> -Hitting enter key does not submit the form Megha Vishwanath Javascript 3 07-20-2004 05:45 AM
Re: JSP form submit does not overwrite request parameter value zalla rouge Java 0 09-02-2003 03:02 PM



Advertisments