You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by BJ Jani <ja...@tsbvi.edu> on 2003/04/30 19:43:12 UTC

Multibox

Hi Folks

Earlier I got some response but I need help to know whether it is possible?
and How Can I accoplish in the situation given below:

I have  need to compares two dynamic lists and all common items checkboxes
are checked when it is displayed to user by JSP page. I have gone through
Struts in Action book. But there we need to have list declare with elements
list "items" in ActionForm. And Since I do not have prior information of
elements for the Lists I cannot define in ActionForm. I will greatly
appreciate any advice or direction to accoplish the task.

Thanks in Advance

BJ


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: Multibox

Posted by James Mitchell <jm...@apache.org>.
----- Original Message -----
From: "BJ Jani" <ja...@tsbvi.edu>
To: <st...@jakarta.apache.org>
Sent: Wednesday, April 30, 2003 1:43 PM
Subject: Multibox


> Hi Folks
>
> Earlier I got some response but I need help to know whether it is
possible?
> and How Can I accoplish in the situation given below:
>
> I have  need to compares two dynamic lists and all common items checkboxes
> are checked when it is displayed to user by JSP page. I have gone through
> Struts in Action book. But there we need to have list declare with
elements
> list "items" in ActionForm. And Since I do not have prior information of
> elements for the Lists I cannot define in ActionForm. I will greatly
> appreciate any advice or direction to accoplish the task.

I'm not sure I understand your problem.

The multibox is used to write one single checkbox and if any values from a
list happen to match that


Here's how I'm building tests for the multibox:

...
...
 String[] s = new String[7];
 for(int i = 1; i < 7; i++){
     s[i] = "field" + i;
 }
 SimpleBeanForTesting sbft = new SimpleBeanForTesting();
 // set this list into a field that accepts a String array
 sbft.setStringArray(s);
 // set the bean in the request and forward to the jsp
...
...

then later in the jsp:
  <html:multibox property="stringArray" value="field1"/>
  <html:multibox property="stringArray" value="field500"/>

will produce this:
  <input type="checkbox" name="stringArray" value="field1"
checked="checked">
  <input type="checkbox" name="stringArray" value="field500">



Notice that the first checkbox will be checked because "field1" was a value
in the list.


>
> Thanks in Advance
>
> BJ
>



--
James Mitchell
Software Developer/Struts Evangelist
http://www.open-tools.org





---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org