Re: need help in JSTL/STRUTS + Custom Tag
Manish Pandit ha scritto:
You can use EL and get attributes from the session. Something like
${sessionScope.result} and ${sessionScope.currentPage}. If you want to
do it in your tag, and u're using the Classic Model, you can use
pageContext.getRequest().getSession().getAttribute(). If you're using
the Simple Model, you will use jspContext().findAttribute().
-cheers,
Manish
Thanks a lot for you replies.
I tried to use EL in my tag but I get any errors.
I've found the following solution (STRUTS save the form bean in the
scope session, so you can retrieve the fields with
<bean:define>...great!!):
<code>
<bean:define id="pagex" name="searchForm" property="page" />
<bean:define id="results" name="searchForm" property="results" />
<bean:define id="range" name="searchForm" property="range" />
<!-- I would remove this scriptlet -->
<%
String pagexS=String.valueOf(pagex);
String resultsS=String.valueOf(results);
String rangeS=String.valueOf(range);
%>
<!-- at bottom...in my tag -->
<p:pager range="<%= rangeS %>" results="<%= resultsS %>" page="<%=
pagexS %>" />
</code>
If I save variables in a session and use something like <p:pager
range="${sessionScope.range}"...I get a runtime exception because
${var} is not resolved.