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 use s:iterator s:include s:param
Date Sun, 17 Feb 2019 18:23:21 GMT
Hi Albert,

I found following at [1].

"Note: Any additional params supplied to the included page are not
accessible within the rendered page through the <s:property…> tag since
no valuestack will be created. You can, however, access them in a
servlet via the HttpServletRequest object or from a JSP page via a
scriptlet.

How To access parameters

Parameters are passed as request parameters, so use the
${param.ParamName} notation to access them. Do not use the property tag
to access parameters in included files."

So it seems you can use ${param.itemList}.

Thanks for using Struts!

Regards.

[1] https://struts.apache.org/tag-developers/include-tag.html

On 2/16/2019 4:33 PM, albert kao wrote:
> This display properly:
> <s:if test="#session.response.items.itemList">
>   <s:iterator value="#session.response.items.itemList">
>     <s:property value="description"/>
>   </s:iterator>
> </s:if>
> 
> I refactor to the following two files, which display nothing.
> I have other codes in items.jsp which confirms that items.jsp is being used
> in showitems.jsp.
> Please help.
> Thanks.
> 
> items.jsp:
> <s:set var="itemList" value="%{parameters.itemList}"/>
> 
> <s:if test="%{itemList}">
>   <s:iterator value="%{parameters.itemList}">
>     <s:property value="description"/>
>   </s:iterator>
> </s:if>
> 
> 
> 
> showitems.jsp:
> <s:include value="items.jsp">
>   <s:param name="itemList" value="#session.response.items.itemList"/>
> </s:include>
> 
Mime
View raw message