tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benin Technologies <benintechnolog...@yahoo.fr>
Subject jsp:getProperty not working
Date Fri, 25 Jan 2013 23:56:07 GMT
Hi,

I'm new to Tomcat/JSP

I have a JSP page that instantiates a bean, then it access the bean 
through a scriptlet, it works fine. But when I replace the scriptlet by 
a <jsp:getProperty.. tag, it doesn't work

Take my code below :
<%= employee.getFirstName() %> IS WORKING, it displays the employee's 
firstname
<jsp:getProperty name="employee" property="firstName" />  IS NOT 
WORKING, displays nothing

any idea why ?



<jsp:useBean id="employee" class="org.company.beans.EmployeeBean" 
scope="request" />
<html><body>
<%
Vector<EmployeeBean> v =(Vector<EmployeeBean>)request.getAttribute("list");
Iterator i = v.iterator();
int j = 0;
while (i.hasNext()) {
     employee = (EmployeeBean)i.next();
     %>

<%= employee.getFirstName() %>                                          
               WORKS
<jsp:getProperty name="employee" property="firstName" />         DOESN'T 
WORK !! WHY ?

<%
}
%>
</body></html>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message