Hi, In my Action class I set an object in one of the session attribute before forwarding to a JSP view. But, the <logic:present> in the JSP view always return false on that object.
Below is my code. Do you know what I'm missing? employeeList is an ArrayList object.
If I use a for loop below (see comment code block), then it finds the employeeList and
return the right data from that array object.
Thanks,
Tuan
**************** My Action code ***********************
...
session.setAttribute( USER_EMPLOYEE_LIST_KEY, employeeList );
// Forward to the appropriate View
return ( mapping.findForward( target ) );
********* My JSP page *********************************
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="com.phs.ezhr.business.vo.EmployeeVO" %>
<%@ page import="com.phs.ezhr.constant.IConstants" %>
<%
ArrayList employeeList = (ArrayList)session.getAttribute(
IConstants.USER_EMPLOYEE_LIST_KEY );
// *************************************************
// THIS CODE WORK, BUT THE <logic:present> does not work
// *************************************************
//for ( int i = 0; i < employeeList.size(); i++ ) {
// out.println( "i = " + i + "<BR>" );
// EmployeeVO e = (EmployeeVO)employeeList.get( i );
// out.println( "Employee ID --> " + e.getEmployeeId() + "<BR>");
//}
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<link rel="stylesheet" type="text/css" href="common/styles/styleMid.css">
<html:html locale="true" >
<head>
<html:base/>
<title><bean:message key="app.label.title" /></title>
</head>
<body leftmargin="0" topmargin="0" rightmargin="0" bottommargin="0" marginwidth="0"
marginheight="0" style="margin: 0px 0px 0px 0px;">
<table cellspacing="0" cellpadding="0" border="0" width="100%" height="100%">
<tr>
<td bgcolor="#F9B949" width="17"> </td>
<td valign="top">
<table cellspacing="0" cellpadding="0" border="0">
<logic:present name="employeeList" scope="session">
<!-- Iterate over the results of the query -->
<logic:iterate name="employeeList" id="employee" scope="session"
type="com.phs.ezhr.business.vo.EmployeeVO" indexId="idx">
....
</logic:iterate>
</logic:present>
</table>
</td>
</tr>
</table>
</body>
</html:html>
<<winmail.dat>>
-- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>

