You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by 徐 伟 <ta...@hotmail.com> on 2007/06/12 04:21:31 UTC

Embedded problem

First, you can look through next jsp codes:

<s:iterator status="stat" value="destObjects">
  <tr>
    <s:iterator value="visibleColumns">
      <td>
        <s:property value="destObjects[%{#stat.index}].%{fieldDefName}" />
      </td>
    </s:iterator>
  </tr>
</s:iterator>

Variable "destObejcts" is a <LIST> type which contains a serial of objects 
named "destObject". 

Variable "visibleColumns" is also a LIST of objects named "visibleColumn", 
and 
"fieldDefName" is a property of "visibleColumn". 

And thus value of expression "visibleColumn.fieldDefName" will be a 
property name of object "destObject".

Above relationship between two objects sounds a bit boring. As a trouble, I 
failed to get the correct values of these dynamic fields of "destObejct", 
and I had tried in many ways, and next Struts2 expressions ALL could not 
work:

<s:property value="destObjects[%{#stat.index}].%{fieldDefName}" />
<s:property value="%{destObjects[#stat.index].%{fieldDefName}}" />
<s:property value="%{fieldDefName}" />


Is there anyone could help me? Thanks.

_________________________________________________________________
享用世界上最大的电子邮件系统― MSN Hotmail。  http://www.hotmail.com  


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


Re: Embedded problem

Posted by Davey Xu <ta...@hotmail.com>.
<s:iterator value="destObjects" id="do">
   <s:iterator value="visibleColumns" id="vc">
     <s:property value="#do.%{vc.fieldDefName}"/>
   </s:iterator>
</s:iterator>

It does not work yet :(

Maybe it is a defect of Struts2 which should be improved in the future.

As a choice, it is a good way to mix some JSTL tag or JS scripts in. But 
that seems to be complicated and boring. 

Is there any other solutions for this kind of question in Struts2.0?




>From: Dave Newton <ne...@yahoo.com>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: Struts Users Mailing List <us...@struts.apache.org>
>Subject: Re: Embedded <s:iterator/> problem
>Date: Mon, 11 Jun 2007 19:32:31 -0700 (PDT)
>
>--- 徐 伟 <ta...@hotmail.com> wrote:
> > First, you can look through next jsp codes:
> >
> > <s:iterator status="stat" value="destObjects">
> >   <tr>
> >     <s:iterator value="visibleColumns">
> >       <td>
> >         <s:property
> > value="destObjects[%{#stat.index}].%{fieldDefName}"
> > />
> >       </td>
> >     </s:iterator>
> >   </tr>
> > </s:iterator>
>
>Try something like:
>
><s:iterator value="destObjects" id="do">
>   <s:iterator value="visibleColumns" id="vc">
>     <s:property value="#do.%{vc.fieldDefName}"/>
>   </s:iterator>
></s:iterator>
>
>I do something very similar in one of my apps but
>don't have access to the code right now :/
>
>d.
>
>
>
>       
____________________________________________________________________________________

>Shape Yahoo! in your own image.  Join our Network Research Panel today!   
http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>For additional commands, e-mail: user-help@struts.apache.org
>

_________________________________________________________________
与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn  


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


Re: Embedded problem

Posted by Dave Newton <ne...@yahoo.com>.
--- Ðì ΰ <ta...@hotmail.com> wrote:
> First, you can look through next jsp codes:
> 
> <s:iterator status="stat" value="destObjects">
>   <tr>
>     <s:iterator value="visibleColumns">
>       <td>
>         <s:property
> value="destObjects[%{#stat.index}].%{fieldDefName}"
> />
>       </td>
>     </s:iterator>
>   </tr>
> </s:iterator>

Try something like:

<s:iterator value="destObjects" id="do">
  <s:iterator value="visibleColumns" id="vc">
    <s:property value="#do.%{vc.fieldDefName}"/>
  </s:iterator>
</s:iterator>

I do something very similar in one of my apps but
don't have access to the code right now :/

d.



      ____________________________________________________________________________________
Shape Yahoo! in your own image.  Join our Network Research Panel today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 



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