You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Caroline Jen <ji...@yahoo.com> on 2004/06/15 23:19:09 UTC
Error Occurred When Using JSP Expression Inside the Struts Tag
I am using the Struts framework. I have a JSP where a
collection of JavaBeans are received in a request
scope.
code:
----------------------------------------------------
<%Collection threadRows = ( Collection
)request.getAttribute( "ThreadBeans" );%>
----------------------------------------------------
Each of the JavaBeans, which I name it as ThreadBean,
has a number of properties. In the beginning of my JSP
and right after the <%@ page
import="org.MyOrg.MyProj.message.ThreadBean" %>, I
have
code:
----------------------------------------------------
<bean:define id="threadbean" name="ThreadBean"
type="org.apache.artimus.message.ThreadBean"
scope="request" />
----------------------------------------------------
I iterate through the collection using the <c:forEach
....> tag:
code:
-------------------------------------------------------
<c:forEach id="threadBean" items="${threadRows}"
varStatus="idx">
<c:choose>
<c:when test="${(idx.count+1)%2==0}">
<tr bgColor=#EEEEEE>
</c:when>
<c:otherwise>
<tr bgcolor=#FFFFFF>
</c:otherwise>
</c:choose>
<td colspan="3">
<a href="viewthread?thread=<c:out
value="{threadBean.threadID}" />">
<B>
<%=SiteUtil.filter( threadBean.getPostTopic(),
false/*html*/, true/*emotion*/, false/*mvnCode*/,
false/*newLine*/, false/*URL*/ )%>
</B>
</a>
</td>
<td align="center">
<c:out value="${threadBean.sender}" />
</td>
<td align="center"><c:out
value="{threadBean.threadReplyCount}" /></td>
<td align="center"><c:out
value="{threadBean.threadViewCount}" /></td>
<td align="center">
by <c:out
value="${threadBean.lastPostMemberName}" />
</td>
</tr>
</c:forEach>
----------------------------------------------------
I have an expression inside the <c:forEach .... >;
tag. In that expression, I am calling the 'filter'
method of another class SiteUtil.java (this class is
also imported to my JSP). I have to pass one of the
properties of the ThreadBean as a parameter to that
'filter' method; i.e. threadBean.getPostTopic(). And
it is an error. My JSP cannot be compiled because of
it.
-Caroline
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org