You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Claudia Woestheinrich <cl...@vit.de> on 2004/09/07 09:51:15 UTC
problem with multibox
Hi,
I have a Problem with using multiboxes. I want to generate following
HTML-Code:
<input type="checkbox" name="sel" value="2002">Ronja
<input type="checkbox" name="sel" value="2003">Petra
<input type="checkbox" name="sel" value="2004">Heini
But I became:
<input type="checkbox" name="sel" value="2002">2002 Ronja
<input type="checkbox" name="sel" value="2003">2003 Petra
<input type="checkbox" name="sel" value="2004">2004 Heini
What must I do???
Thanks
Claudia
My JSP-Code:
<logic:iterate id="item" name="form" property="items">
<tr><td>
<html:multibox property="sel">
<bean:write name="item" property="jahr"/>
<bean:write name="item" property="name"/>
</html:multibox>
<bean:write name="item" property="jahr"/>
<bean:write name="item" property="name"/>
</td></tr>
</logic:iterate>
And my ActionForm:
public class MyForm extends ActionForm{
/** Creates a new instance of MyForm */
public MyForm() {
MyBean eins=new MyBean();
eins.setJahr("2002");
eins.setName("Ronja");
MyBean zwei=new MyBean();
zwei.setJahr("2003");
zwei.setName("Petra");
MyBean drei=new MyBean();
drei.setJahr("2004");
drei.setName("Heini");
init=new Object[3];
init[0]=eins;
init[1]=zwei;
init[2]=drei;
}
private Object[] items, init,sel;
public Object[] getItems(){
return items;
}
public void setItems(Object[] v){
items=v;
}
public Object[] getSel(){
return sel;
}
public void setSel(Object[] selected){
sel=selected;
}
public void reset(ActionMapping mapping,HttpServletRequest req){
System.out.println("bin in reset");
items=new Object[3];
items=init;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: problem with multibox
Posted by Deepak <de...@ltp.soft.net>.
Try,
<logic:iterate id="item" name="form" property="items">
<tr><td>
<html:multibox property="sel">
<bean:write name="item" property="jahr"/>
</html:multibox>
<bean:write name="item" property="name"/>
</td></tr>
</logic:iterate>
----- Original Message -----
From: "Claudia Woestheinrich" <cl...@vit.de>
To: <us...@struts.apache.org>
Sent: Tuesday, September 07, 2004 1:21 PM
Subject: problem with multibox
> Hi,
>
> I have a Problem with using multiboxes. I want to generate following
> HTML-Code:
>
> <input type="checkbox" name="sel" value="2002">Ronja
> <input type="checkbox" name="sel" value="2003">Petra
> <input type="checkbox" name="sel" value="2004">Heini
>
> But I became:
> <input type="checkbox" name="sel" value="2002">2002 Ronja
> <input type="checkbox" name="sel" value="2003">2003 Petra
> <input type="checkbox" name="sel" value="2004">2004 Heini
>
> What must I do???
> Thanks
> Claudia
>
> My JSP-Code:
>
> <logic:iterate id="item" name="form" property="items">
> <tr><td>
> <html:multibox property="sel">
> <bean:write name="item" property="jahr"/>
> <bean:write name="item" property="name"/>
>
> </html:multibox>
> <bean:write name="item" property="jahr"/>
> <bean:write name="item" property="name"/>
>
> </td></tr>
> </logic:iterate>
>
> And my ActionForm:
>
> public class MyForm extends ActionForm{
>
> /** Creates a new instance of MyForm */
> public MyForm() {
> MyBean eins=new MyBean();
> eins.setJahr("2002");
> eins.setName("Ronja");
>
> MyBean zwei=new MyBean();
> zwei.setJahr("2003");
> zwei.setName("Petra");
>
> MyBean drei=new MyBean();
> drei.setJahr("2004");
> drei.setName("Heini");
>
> init=new Object[3];
> init[0]=eins;
> init[1]=zwei;
> init[2]=drei;
>
>
> }
>
> private Object[] items, init,sel;
>
>
> public Object[] getItems(){
> return items;
> }
>
> public void setItems(Object[] v){
> items=v;
> }
>
> public Object[] getSel(){
> return sel;
> }
>
> public void setSel(Object[] selected){
> sel=selected;
> }
>
>
>
> public void reset(ActionMapping mapping,HttpServletRequest req){
> System.out.println("bin in reset");
>
> items=new Object[3];
> items=init;
>
> }
>
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org