struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timo Kinnunen" <timo.kinnu...@gmail.com>
Subject s:bean with s:param inside s:bean doesn't work, jsp:useBean does
Date Fri, 17 Aug 2007 16:56:57 GMT
I produce XML from a jsp page. I'm iterating the results of a DAO. For each
result, I want to use another DAO and iterate over result from that. I'm
declaring the inner DAO using s:bean, but I can't access the loop variable
from inside s:param. If I change the nested DAO declaration to use
jsp:useBean it works as expected. What am I doing wrong? Here's the jsp:

<s:bean name="com.geniem.wf.dao.ProfileDAO">
<c:forEach var="curr" items="${allProfiles}">
<link url="${base}/users/${curr.handle}"><c:out value="${curr.nick
}"/></link>

<%-- This works:
<jsp:useBean id="message" class="com.geniem.wf.dao.MessageDAO"
scope="page"></jsp:useBean>
<jsp:setProperty name="message" property="page" value="0"/>
<jsp:setProperty name="message" property="pageSize" value="2"/>
<jsp:setProperty name="message" property="handle" value="${curr.handle}"/>
--%>

<s:bean name="com.geniem.wf.dao.MessageDAO" id="message">

<%-- This sets null instead of correct value: --%>
<s:param name="handle" value="${curr.handle}"/>

<s:param name="page" value="0"/>
<s:param name="pageSize" value="2"/>

<%-- This shows the value OK: --%>
<test value="${base}" value2="${curr.handle}"/>

<c:forEach var="msg" items="${profileMessages0}">
<message
 fromText="${msg.from.nick}"
 fromCmd="${base}/users/${msg.from.handle}"
 ownercomment="${msg.from.id == bean.profile.id}"
 content="<c:out value="${msg.content}"/>"
 index="${loop.index}"
 time="<s:text name="users.messages.elapsed">
 <s:param value="${bean.time - msg.created}"/>
 <s:param value="${(bean.time - msg.created) / 1000}"/>
 <s:param value="${(bean.time - msg.created) / 60000}"/>
 <s:param value="${(bean.time - msg.created) / 3600000}"/>
 <s:param value="${(bean.time - msg.created) / 86400000}"/>
 </s:text>"
/>
</c:forEach>
</s:bean>
</c:forEach>
</s:bean>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message