struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alberto A. Flores" <aaflo...@gmail.com>
Subject Re: substitute for JSP EL tags in struts 2.0.11
Date Wed, 12 Dec 2007 19:34:38 GMT
Have you tried:

<c:set var="foo" value="${jobResults}" scope="request"/>

Now foo has (should) have the value of the row and placed in request scope.

Swathi Ram wrote:
> I'm unable to get the current row using PageContext.
> It is throwing me an error.
> 
> 
> 
> Alberto A. Flores wrote:
>> Ok, this is a bit more of a hack, but should work (haven't test it).
>>  From the DisplayTag documentation (note that "id" is similar to "uid"):
>>
>> "The object representing the current row is also added to the 
>> pageContext under this name, so that you can refer to it in column 
>> bodies using ${uid}"
>>
>>
>>> <display:table name="people" requestURI="" pagesize="${row}" sort="list"
>>> id="jobResults" class="candSearchResults" >
>>      <% Object job = pageContext("jobResults")
>>         request.setAttribute("jobResult", job);
>>      %>
>>      <display:column>
>>        <s:checkbox theme="simple" name="checked" 
>> fieldValue="%{#request.jobResult}"/>
>>      </display:column>
>>
>>>      <display:column property="preferedName" title="Name" sort="true" />
>>> <display:column property="userName" title="Username (e-mail)" sort="true"
>>> maxLength="10"/>
>>> </display:table>
>>>
>> Have you consider whether the using the struts tag there is even needed?
>> Why not doing trying JSTL with HTML code?
>>
>>
>>> When the checkbox is checked then I should be able to get the
>>> corresponding
>>> userid value in the action class. 
>>> Any idea how I can achieve that.
>>>
>>> Thanks
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> Alberto A. Flores wrote:
>>>> If you mean for "jsps using EL tags" the JSTL tags, then a quick fix can

>>>> be to make your EL expressions use scope="request" and make the <s: ...>

>>>> tags (Struts 2.x) use the expression "%{#request.varInScope}" to get to 
>>>> them.
>>>>
>>>> If you mean the EL tags from Struts 1.x, then you are going to have to 
>>>> change a lot more and take each case indivually to use JSTL (or Struts 
>>>> 2.x tags). The latter work (in my opinion is more work)
>>>>
>>>>
>>>> Swathi Ram wrote:
>>>>> I recently upgraded to Struts 2.0.11, and all my jsps using the EL tags
>>>>> don't
>>>>> work anymore. 
>>>>> I'm using these along with displaytags, to pass values of checkbox
>>>>> lists
>>>>> or
>>>>> field values to the action class. 
>>>>> Is there any other way to do this. 
>>>>>
>>>>> For example, in a table list of users, if the checkbox is checked then
>>>>> the
>>>>> userid must be passed to the action class. 
>>>>>
>>>>> Thanks.
>>>>>
>>>> -- 
>>>>
>>>> Alberto A. Flores
>>>> http://www.linkedin.com/in/aflores
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>> -- 
>>
>> Alberto A. Flores
>> http://www.linkedin.com/in/aflores
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



Mime
View raw message