You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Anet <fi...@yahoo.com> on 2006/10/20 14:01:31 UTC

Problem with hidden String[] object

Hi everybody;
  I have a String[] object. but I can't pass it via form as a hidden object. 
Is it wrong to pass a string[] object as html:hidden ???
  Thanks.
   

 		
---------------------------------
How low will we go? Check out Yahoo! Messenger’s low  PC-to-Phone call rates.

Re: Problem with hidden String[] object

Posted by Anet <fi...@yahoo.com>.
Hi;
  
Thank very much for your help, but my string[] object filled dynamic.I don't know its size at first.
and I don't need its data on my form, I just need them to pass with form when the form is submitted.
also your solution can help me. just I want to know something.
 I saw in a document that only String type can be used with <html:hidden>. Is this my error? trying to pass array 
with <html:hidden>??
  thanks a lot.

WongTsengÍõÔø <wa...@gmail.com> wrote:
  Maybe you can make your String[] Object a indexed attribute of your
formbean. Then use html:hidden:
something like this below:
Class YourFormBean extends ActionForm{
String[] aaas = new String[5];
public String getAaa(int index){
return aaas[index];
}
public void setAaa(String a,int index){
aaas[index] = a;
}
}

then in your jsp:





2006/10/20, Anet :
>
> Hi everybody;
> I have a String[] object. but I can't pass it via form as a hidden
> object.
> Is it wrong to pass a string[] object as html:hidden ???
> Thanks.
>
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call
> rates.
>



-- 
Wong Tseng
ÍõÔø


 			
---------------------------------
Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business.

Re: Problem with hidden String[] object

Posted by WongTseng王曾 <wa...@gmail.com>.
Maybe you can make your String[] Object a indexed  attribute  of  your
formbean. Then  use  html:hidden:
something like this below:
 Class YourFormBean extends ActionForm{
       String[] aaas = new String[5];
       public String getAaa(int index){
             return aaas[index];
       }
       public void setAaa(String a,int index){
            aaas[index] = a;
       }
}

then in your jsp:

    <html:hidden property="aaas[0]" />
    <html:hidden property="aaas[1]" />
   <html:hidden property="aaas[2]" />

2006/10/20, Anet <fi...@yahoo.com>:
>
> Hi everybody;
>   I have a String[] object. but I can't pass it via form as a hidden
> object.
> Is it wrong to pass a string[] object as html:hidden ???
>   Thanks.
>
>
>
> ---------------------------------
> How low will we go? Check out Yahoo! Messenger's low  PC-to-Phone call
> rates.
>



-- 
Wong Tseng
王曾