[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Displaytag help in Struts 2
From:       Jeromy Evans <jeromy.evans () blueskyminds ! com ! au>
Date:       2007-07-18 0:49:37
Message-ID: 469D63A1.8040607 () blueskyminds ! com ! au
[Download RAW message or body]

Yes, I use it as stated previously.  Is row the object you think it is?  
You either have a typo or you're trying to access properties of row that 
don't exist.

The code below shows plain html contained in a column that accesses 
properties of the current row.

<s:if test="xxxList.size > 0">
  <display:table name="xxxList" id="row">
     <s:set name="myrow" value="#attr.row"/>
     <display:column sortable="true" title="Name" property="name"/>
     <display:column sortable="true" title="Date Created" 
property="dateCreated" decorator="xxx.decorators.ShortDateDecorator"/>
     <display:column sortable="false" title="Example">
         View <a href="xxx.action?xxxId=<s:property 
value="#myrow.id"/>"><s:property value="#myrow.name"/></a>
      </display:column>
   </display:table>
</s:if>

* note there are better ways to generate an anchor in a displaytag 
table.  This is demonstrating how to access the current row using 
struts2 tags.

kishanparikh wrote:
> Hello,
>
> Were you able to get the "row" to work? I am trying to get hold of the my
> properties using the "row" variable inside of a displaytag table. The table
> itself if working fine.
>
> I have tried both the JSTL and the OGNL way but the "row" is always empty.
>
> Does anyone know how to get this working for Struts2? Any help is
> appreciated.
>
> Thank you.
>
> - Kishan
>
> Jeromy Evans - Blue Sky Minds wrote:
>   
>>     
>>> Within the displaytag 'display:table' tag, a 'row' object is set into
>>> the page context.
>>> How is this accessible from Struts 2?
>>>       
>> #attr is the  OGNL to access the page context.    #attr.row will access 
>> your display tag id object named row
>>
>> eg. #1
>>
>> <s:url action="/MyAction.action" value="%{#attr.row.param1}"></s:url>	
>>
>>
>> eg. #2
>>
>> <display:table name="list" id="row">
>>      <s:set name="myrow" value="#attr.row"/>
>>       <s:url action="/MyAction.action" value="%{#myrow.param1}"></s:url>
>>
>> #attr is described here:
>> http://struts.apache.org/2.x/docs/ognl.html
>>
>> ---------------------------------------------------------------------
>> 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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic