struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john.ches...@convergys.com
Subject Getting property value from bean in a collection into a script variable
Date Wed, 15 Dec 2004 21:01:16 GMT




Hi guys,
I am trying to pull the value from a property in a collection(LinkedList)
stored in the request object and store it in a script variable.  I can
write the property value to the response page using a <bean:write> tag
inside a <logic:iterate> tag, but I can't seem to find a way to get the
value into a script variable.  Below, I tried the <bean:parameter> tag with
no luck (it stores null in the variable lastUpdt).  Any suggestions?  For
collections, do I have to do something more elaborate than using the
bean:parameter tag?

Here's the jsp code.  The collection is stored in the "classmateList"
attribute of the response object.  Within each bean in that collection, I
am trying to take the value of the "lastUpdated" property and store it in
the script variable "lastUpdt".
Thanks!

----------------------------------------------------------------------------------------

<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<div style="text-align: justify;">
<logic:iterate id="cmateList" name="classmateList">
<%
String updatedFlag = "";
%>
<bean:parameter id="lastUpdt" name="lastUpdated" value=""/>
lastUpdated: <%=lastUpdt%><br>
<br>
<%
if (lastUpdt == "" || lastUpdt == "0000-00-00") {
    updatedFlag = "&nbsp;&nbsp;&nbsp";
}
else {
    updatedFlag = "* ";
}
%>
<%=updatedFlag%><a
href=BuildClassmateInfoViewAction.do?viewFirstName=<bean:write
name="cmateList" property="firstName"/>&viewLastName=<bean:write
name="cmateList" property="lastName"/>><bean:write name="cmateList"
property="firstName"/> <bean:write name="cmateList"
property="lastName"/></a><br>
</logic:iterate>
</div>
<br>
<br>
<div style="text-align: center; color: rgb(0, 0, 102);">
    <html:form action="/BuildHomeViewAction">
        <html:submit value="Return to Your Home Page"/>
    </html:form>
</div>



--
"NOTICE:  The information contained in this electronic mail transmission is
intended by Convergys Corporation for the use of the named individual or
entity to which it is directed and may contain information that is
privileged or otherwise confidential.  If you have received this electronic
mail transmission in error, please delete it from your system without
copying or forwarding it, and notify the sender of the error by reply email
or by telephone (collect), so that the sender's address records can be
corrected."


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message