I'm not sure what you mean by 'request object is serially parsed.' It doesn't
matter where the parameter is in the stream. It doesn't matter if the parameters
are sent in the order they are on the page, or alphabetically, or randomly, if
you call
response.getParameterValues(String);
the correct parameter will be obtained from the stream. This works for POST as
well as GET. The only time it might matter is if your code gets the input stream
directly and parses the parameters itself. (But why would you do that when the
servlet container does it for you?)
Even if you parse the string yourself, there is a solution. All you need to do
is to tell the designer that the names of the input tags cannot be changed. That
is, if you have an input tag in a form
<input type="checkbox" name="myCheckbox" value="someValue">
the designer can put this tag anywhere, can change the value to anything, as
long as the name doesn't change. Your servlet doesn't care where on the page
this checkbox is or where in the input stream the parameter is located. The
servlet knows that if it calls getParameterValues or parses the String it will
find myCheckbox and can parse the value. (If myCheckbox can't be found, nothing
was checked, or the designer changed the name after you said not to.)
Unless there is agreement on which fields in the database correspond to which
elements on the user interface, then this is, for most purposes, an unsolvable
problem. What it boils down to is an interface control problem. You and the
designer have to agree on the names in the page. That way your servlet knows how
to get the values from the page. Your servlet has to have an agreement with
whatever software inserts into the database (might be the servlet, might be some
other class), on how to translate between names on the user interface and fields
in the database.
Ricardo Camilo Lopez wrote:
>
> Hi,
>
> I already searched for "order", "parameter", and didn't find any
> "decent" way to deal with this issue, I thought it was provided as part
> of the javax.servlet API.
>
> I need to update values in a database from a form submited to a servlet
> via GET/POST.
>
> What the problem is? :-)
>
> Thing is that:
>
> ._ Since the request object is serially parsed the parameters are gotten
> in in the order they are read.
>
> ._ I want to do it in a way that, the right values are put in the right
> order in the tables regardless of the order they appear in the page. So
> when I pass my jdsp's to a designer they can present them as they
> please.
>
> How do you do that?
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html