You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by shahfazal <fa...@louisiana.edu> on 2003/12/26 22:07:15 UTC

checkbox value from getter in collection of value object

Hi all
i already posted twice about this but i guess my email program had trouble 
formatting my mail or somethign but anyway long thing short i have a 
collection of ApplicationVO value objects, i need to display them in rows 
on a jsp. so i iterate thru the collection of the value objects, and at the 
beginning of the row i need a check box with a value of one of the 
properties of the value object how do i go about it? i know the multibox 
can do this but i'm having trouble binding the property to the value of 
this multibox .. can anyone help me?

my code :

<logic:iterate id="appList" name="incompleteFolderForm" 
property="applications">
         <html:multibox property=???>???</html:multibox> <!-- i need the 
checkbox to have the value of the 'applicantId' getter property of my value 
object
         <bean:write name="appList" property="firstName"/>
         <bean:write name="appList" property="lastName"/>
</logic:iterate>

can anyone help me?? i'm kinda desperate to find a solution ...would be 
really great if anyone could help me out


Regards..

Shahfazal Mohammed
Research A$$i$tant
Center for Business and Information Technologies
http://www.cbit.louisiana.edu
337.482.0626 work
337.322.1946 cell
337.233.1092 home 


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


Re: checkbox value from getter in collection of value object

Posted by atta-ur rehman <at...@numetrics.com>.
Hello Shahfazal,

As i understand from the 'applicantId' getter, you want to use these 
checkboxes as a selecting indicator. If so, create a String[] 
getter/setter in your ActionForm, let say:

setSelectedApplicants(String[] ids)
String[] getSelectedApplicants()

now in your jsp you can write:

<html:multibox property="selectedApplicants">
	<bean:write name="appList" property="applicantid"> <!-- this is what i 
get from your logic iterate, basically, you need to get applicantId 
from your bean -->
</html:multibox>

this should produce HTML like

  <input type="checkbox" name="selectedApplicants" value="100001">
  <input type="checkbox" name="selectedApplicants" value="100002">

now when you submit page, and inspect 
ActionForm.getSelectedApplicants() string array, you should get the IDs 
of selected checkboxes.

Hope this helps!

ATTA

On Dec 26, 2003, at 1:07 PM, shahfazal wrote:

> Hi all
> i already posted twice about this but i guess my email program had 
> trouble formatting my mail or somethign but anyway long thing short i 
> have a collection of ApplicationVO value objects, i need to display 
> them in rows on a jsp. so i iterate thru the collection of the value 
> objects, and at the beginning of the row i need a check box with a 
> value of one of the properties of the value object how do i go about 
> it? i know the multibox can do this but i'm having trouble binding the 
> property to the value of this multibox .. can anyone help me?
>
> my code :
>
> <logic:iterate id="appList" name="incompleteFolderForm" 
> property="applications">
>         <html:multibox property=???>???</html:multibox> <!-- i need 
> the checkbox to have the value of the 'applicantId' getter property of 
> my value object
>         <bean:write name="appList" property="firstName"/>
>         <bean:write name="appList" property="lastName"/>
> </logic:iterate>
>
> can anyone help me?? i'm kinda desperate to find a solution ...would 
> be really great if anyone could help me out
>
>
> Regards..
>
> Shahfazal Mohammed
> Research A$$i$tant
> Center for Business and Information Technologies
> http://www.cbit.louisiana.edu
> 337.482.0626 work
> 337.322.1946 cell
> 337.233.1092 home
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>


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