struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yasser Zamani <yasserzam...@apache.org>
Subject RE: How to pass parameters to s:component inside s:iterator?
Date Sun, 06 Oct 2019 07:03:13 GMT
Hi Albert,

Could you try without the inner s:if tag? I remember that some tags don't work inside each
other :(

Despite if it was the problem or not, I think it's more readable design to move iterator and
if tags inside the component (items.jsp) itself, have you ever considered it?

Regards.

>-----Original Message-----
>From: albert kao <albertkao3@gmail.com>
>Sent: Saturday, October 5, 2019 7:26 PM
>To: Struts Users Mailing List <user@struts.apache.org>
>Subject: How to pass parameters to s:component inside s:iterator?
>
>How to pass parameters to s:component inside s:iterator?
>e.g. These simpilied codes pass the parameter "John" to items.jsp.
>However, the browser displays an empty string.
>
><s:iterator begin="0" end="%{client.size - 1}" value="client"
>status="status">
>  <s:component template="items.jsp" theme="custom"
>name="%{'client['+#status.index+'].firstName'}" label="firstName.label">
>    <s:if test="#status.index == 1">
>      <s:param name="inputValue" value="'John'"/>
>    </s:if>
>  </s:component>
></s:iterator>
>
>
>items.jsp:
><s:textfield
>  name="%{#fieldname}"
>  value="%{parameters.inputValue}"/>
>/>
Mime
View raw message