You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by styl9090 <st...@yahoo.com> on 2007/02/01 16:21:57 UTC

problem.

Hi All,

In my application, I need to generate check boxes for every row of data.
I set the data as a list of objects in my controller and I access the same
in JSP using <logic:iterate>
For each row of this data, I need to add a checkbox with 'value' attribute
as a field in the data row object... here it is user_id.(data set is in
request scope)
How can I achieve this? Or do I need to use traditional java code in JSP :(

I have like this:
<logic:iterate id="userObj" name="userResults" type="com.UserDO">
   <html:checkbox name="testForm" property="checkList"
value=???????????????????? />
    and I have other data:
   <bean:write name="userObj" property="user_id"/>
   <bean:write name="userObj" property="first_name"/>...
</logic:iterate>

Any help is appreciated.

Thanks in Advance,
Shekar. 
-- 
View this message in context: http://www.nabble.com/%3Chtml%3Acheckbox%3E-problem.-tf3155449.html#a8750089
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: problem.

Posted by styl9090 <st...@yahoo.com>.
Thank you so much for you help, Christopher & Dave.


Dave Newton-4 wrote:
> 
> --- styl9090 <st...@yahoo.com> wrote:
>> As I could not find any resolution for this issue, I
>> would like to write java code in JSP :(
> 
> Life goes on.
> 
>> [...] checkbox with 'value' attribute as a field in 
>> the data row object... here it is user_id.(data set 
>> is in request scope)
> 
> Maybe the EL taglibs will help:
> http://struts.apache.org/1.x/struts-el/struts-el.html
> 
> Dave
> 
> 
> 
>  
> ____________________________________________________________________________________
> Expecting? Get great news right away with email Auto-Check. 
> Try the Yahoo! Mail Beta.
> http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%3Chtml%3Acheckbox%3E-problem.-tf3155449.html#a8812810
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: problem.

Posted by Dave Newton <ne...@yahoo.com>.
--- styl9090 <st...@yahoo.com> wrote:
> As I could not find any resolution for this issue, I
> would like to write java code in JSP :(

Life goes on.

> [...] checkbox with 'value' attribute as a field in 
> the data row object... here it is user_id.(data set 
> is in request scope)

Maybe the EL taglibs will help:
http://struts.apache.org/1.x/struts-el/struts-el.html

Dave



 
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check. 
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html 

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


Re: problem.

Posted by styl9090 <st...@yahoo.com>.
As I could not find any resolution for this issue, I would like to write java
code in JSP :(



styl9090 wrote:
> 
> Hi All,
> 
> In my application, I need to generate check boxes for every row of data.
> I set the data as a list of objects in my controller and I access the same
> in JSP using <logic:iterate>
> For each row of this data, I need to add a checkbox with 'value' attribute
> as a field in the data row object... here it is user_id.(data set is in
> request scope)
> How can I achieve this? Or do I need to use traditional java code in JSP
> :(
> 
> I have like this:
> <logic:iterate id="userObj" name="userResults" type="com.UserDO">
>    <html:checkbox name="testForm" property="checkList"
> value=???????????????????? />
>     and I have other data:
>    <bean:write name="userObj" property="user_id"/>
>    <bean:write name="userObj" property="first_name"/>...
> </logic:iterate>
> 
> Any help is appreciated.
> 
> Thanks in Advance,
> Shekar. 
> 

-- 
View this message in context: http://www.nabble.com/%3Chtml%3Acheckbox%3E-problem.-tf3155449.html#a8753148
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: problem.

Posted by Christopher Goldman <cg...@dhapdigital.com>.
On Thu, 2007-02-01 at 07:21 -0800, styl9090 wrote:
> Hi All,
> 
> In my application, I need to generate check boxes for every row of data.
> I set the data as a list of objects in my controller and I access the same
> in JSP using <logic:iterate>
> For each row of this data, I need to add a checkbox with 'value' attribute
> as a field in the data row object... here it is user_id.(data set is in
> request scope)
> How can I achieve this? Or do I need to use traditional java code in JSP :(
> 
> I have like this:
> <logic:iterate id="userObj" name="userResults" type="com.UserDO">
>    <html:checkbox name="testForm" property="checkList"
> value=???????????????????? />
>     and I have other data:
>    <bean:write name="userObj" property="user_id"/>
>    <bean:write name="userObj" property="first_name"/>...
> </logic:iterate>

Shekar,

If you use the html-el taglib, your html:checkbox value can be
"${userObj.propertyName}" where "propertyName" is whatever property you
need from your user object.

With the non-EL HTML taglib, you would need to set the property value in
the page scope with something like this before the html:checkbox tag:

  <c:set var="checkboxVal" value="${userObj.propertyName}"/>

Then the value attribute of the checkbox tag should just be
"checkboxVal".

I'm not sure how the properties with underscores translate into EL
expressions.

And it may take some tweaking; I'm writing this out off the top of my
head.  But I felt that even that was better than allowing you to go
forward with Java scriptlets.

Chris


-- 
Christopher D. Goldman
cgoldman@dhapdigital.com



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