you just need as="array"
and you will get a String[]

On Wed, Jul 03, 2002 at 11:42:56AM -0600, Matthew Hailstone wrote:
> I'm trying to access multiple values of a request parameter resulting
> from a multiple select HTML element.
> 
>             String stateString = "CA";
>             int iLengthStateString = 0;
>             for( int i=0; i &lt; <xsp-request:get-parameter-values
> name="state"/>.getSize() ; i++ ){
>               stateString += ((i>0?" ":"") +
> <xsp-request:get-parameter-values name="state"/>.getElement(i));
>             }
>             iLengthStateString = stateString.length();
>             <xsp-session:set-attribute
> name="state"><xsp:expr>stateString</xsp:expr></xsp-session:set-attribute
> >
>             <field id="state" label="State" type="text" enable="false">
>               <size><xsp:expr>iLengthStateString</xsp:expr></size>
>               <value><xsp:expr>stateString</xsp:expr></value>
>             </field>
> 
> It looks like in the generated .java file that I'm using the
> <xsp-request:get-parameter-values name="state"/> tag incorrectly. I'm
> expecting it to return an ArrayList or Vector or something, but it's
> not. I've looked in the online documentation
> (http://xml.apache.org/cocoon/userdocs/xsp/request.html) but I'm not
> understanding the "as" attribute and/or how to use it in an example of
> code. Any thoughts on this would be extremely helpful.
> 
> Environment:  Tomcat 4.1.3, Cocoon 2.1-dev
> 
> Thanks,
> 
> Matthew
> 
> P.S. Here is the compile exception:
> 
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
>           null);
> 
> // start error (lines 783-783) " illegal start of expression"
>         .getSize() ; i++ ){
> 
> // end error
>               stateString += ((i>0?" ":"") + 
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
> 
> ...
> ERROR 2 (D:\apps\Tomcat
> 4.1\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/
> eval/logic\form_xsp.java):
> ...
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
>           null);
> 
> // start error (lines 783-783) " ';' expected"
>         .getSize() ; i++ ){
> 
> // end error
>               stateString += ((i>0?" ":"") + 
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
> 
> ...
> ERROR 3 (D:\apps\Tomcat
> 4.1\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/
> eval/logic\form_xsp.java):
> ...
>           else{
>             String stateString = "UT";
>             int iLengthStateString = 0;
>             for( int i=0; i < 
> 
> // start error (lines 779-779) " 'void' type not allowed here"
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
> 
> // end error
>           "state",
>           null,
>           null);
>         .getSize() ; i++ ){
> 
> ...
> ERROR 4 (D:\apps\Tomcat
> 4.1\work\Standalone\localhost\cocoon\cocoon-files\org/apache/cocoon/www/
> eval/logic\form_xsp.java):
> ...
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
>           null);
> 
> // start error (lines 783-783) " variable i not found in class
> org.apache.cocoon.www.eval.logic.form_xsp"
>         .getSize() ; i++ ){
> 
> // end error
>               stateString += ((i>0?" ":"") + 
>           XSPRequestHelper.getParameterValues(objectModel,
> this.contentHandler,
>           "state",
>           null,
> 
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
> 
> To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
> For additional commands, e-mail:   <[EMAIL PROTECTED]>

---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <[EMAIL PROTECTED]>
For additional commands, e-mail:   <[EMAIL PROTECTED]>

Reply via email to