Title: RE: How to get request prameters in right order.

What I have done in the past is create all my webpage element names in a standard way, such as Element_Data_Field_1, where I could parse all the form elements and any that begin with 'Element' are for XML and then I could create an element called 'Data' that contained an element called 'Field' that had an id attribute

of 1. So my form elements would become:
<Page>
        <Data>
                <Field id='1'/>
                <Field id='2'/>
        </Data>
        <OtherData>
                <OtherField id='1'/>
                <OtherField id='2'/>
        </OtherData>
</Page>

This worked fairly well, and I could have multiple levels of xml from my form elements.

Although this doesn't control the order of the form elements, you can control them with the id.

hope this helps,
Charlie

-----Original Message-----
From: Anthony [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 27, 2001 12:00 PM
To: [EMAIL PROTECTED]
Subject: Re: How to get request prameters in right order.


Krzysztof Zielinski wrote:

> Hello.
>
> I'm trying to get all parameters from request in right order.
>  Right order means that I need parameters in order as they were in HTML
>  Form.

Web browsers are not required to return the form values in the order they
are in in the form.
You should therefore not expect the results to be returned in any
particular order.
Bap.

>
>
> I can get all parameters by the help request.getParameterNames() but
>  it returns them as hash table keys. So we lost their original order.
>
> I have tried to use request.getInputStream() and get from the
>  ServletInputStream all parameters.
>
> Here is a BIG problem.
>
> I can't use request.getParameter() or request.getParameterNames() with
>  request.getInputStream().
> When I have used once request.getParameter() after this
>  request.getInputStream() returns empty streem.
>
> I have to be able to get stream after request.getParameter() because
> I'm using Cocoon. Cocoon calls request.getParameter() method before I
>  get request.getInputStream().
> This disadvantage is bigger because I can't use request.getParameter()
>  after using request.getInputStream().
>
> I have thought about some possible solutions:
> 1. Implement my own Request where getParameterNames()  return
>    parameters in right order.
>    This is done in Cocoon2 for specific form content type
>     "multipart/form-data"
>    Create my own form content type eg:"request/in-right-order" and for
>    this kinds of request use new Request implementation.
> 2. Write a patch to Request where could be possible to get
>    request.getInputStream() and request.getParameter() together.
> 3. Ask Tomcat developers about possible solution. :)
>
> --
> Best regards,
>  Krzysztof                          mailto:[EMAIL PROTECTED]
>   ICQ # 47933362

Reply via email to