You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by HaydenWANG <nj...@hotmail.com> on 2008/10/27 11:01:02 UTC
How to pass the multidimensional values to form in Struts 1
Hi!
I met one condition:
I have one page and in this page, it includes one list of Person, and each
person has a list of addresses.
I created one Map of persons in the form:
public void MyForm() extends ActionForm{
private HashMap<String, Person>personsMap = new HashMap();
public void getName(String index){
........................
}
public void setName(String index, String name){
.......................
}
public String getAddress(String indexX, String addIndexStr){
.........................
}
public String setAddress(String indexX, String addIndexStr, String
newAddres){
....................
}
}
===========================
in my jsp I used:
<html:text property="name(0)"/>
<html:text property="name(1)"/>
<html:text property="address(0)(1)"/>
<html:text property="address(0)(2)"/>
==============================
for the name, it works OK!
But it doesn't work for address.
Could any one help me?
Thanks a lot!
--
View this message in context: http://www.nabble.com/How-to-pass-the-multidimensional-values-to-form-in-Struts-1-tp20184668p20184668.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: How to pass the multidimensional values to form in Struts 1
Posted by Paweł Wielgus <po...@gmail.com>.
Hi Hayden,
coudn't You just iterate over this map, and use indexed properties?
Best greetings,
Paweł Wielgus.
2008/10/27 HaydenWANG <nj...@hotmail.com>:
>
> Hi!
> I met one condition:
> I have one page and in this page, it includes one list of Person, and each
> person has a list of addresses.
> I created one Map of persons in the form:
>
> public void MyForm() extends ActionForm{
> private HashMap<String, Person>personsMap = new HashMap();
>
> public void getName(String index){
> ........................
> }
>
> public void setName(String index, String name){
> .......................
> }
>
> public String getAddress(String indexX, String addIndexStr){
> .........................
> }
>
> public String setAddress(String indexX, String addIndexStr, String
> newAddres){
> ....................
> }
> }
>
> ===========================
> in my jsp I used:
> <html:text property="name(0)"/>
> <html:text property="name(1)"/>
> <html:text property="address(0)(1)"/>
> <html:text property="address(0)(2)"/>
> ==============================
> for the name, it works OK!
> But it doesn't work for address.
>
> Could any one help me?
> Thanks a lot!
>
>
>
>
>
>
> --
> View this message in context: http://www.nabble.com/How-to-pass-the-multidimensional-values-to-form-in-Struts-1-tp20184668p20184668.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>