Hi, I'm not sure at all if this is the problem but let's see: do you use <jsp:useBean> tag for the "emp" page bean? AFAIK that tag is responsible for creating the object in page's context.
hope this helps Janos |-----Original Message----- |From: Rich Sneiderman [mailto:[EMAIL PROTECTED]] |Sent: Tuesday, February 19, 2002 6:51 AM |To: [EMAIL PROTECTED] |Subject: Strange javabean problem | | |Hi Folks, | |I'm using Tomcat 4.01 with Jbuilder 6. I've got a strange problem. It |seems that if I try to dump data from a Java bean using the |<jsp:getProperty> tag I don't get the data. However, if I reference the |value of the bean directly in a scriptlet it works fine. | |Here's a code snippet: | |<% | ArrayList la = (ArrayList) request.getAttribute("list"); | if ( la != null ) { | Iterator iter = la.iterator(); | while(iter.hasNext()) { | emp = (EmployeeBean)iter.next(); |%> |<tr><td><%= emp.getFirstName() %></td> | <td><%= emp.getLastName() %></td> | <td><%= emp.getTitle() %></td> |</tr> | |<tr><td><jsp:getProperty name="emp" property="firstName" /></td> | <td><jsp:getProperty name="emp" property="lastName" /></td> | <td><jsp:getProperty name="emp" property="title" /></td> |</tr> |<% | } | } |%> | |The getters work but the <jsp:getProperty> that immediately follows |doesn't. The strings are not in the generated HTML. I've looked at the |generated servlet code and it looks ok. | |The scriptlet's version of one line is: | out.print( emp.getTitle() ); | |The getProperties version is: | |out.print(JspRuntimeLibrary.toString((((test.EmployeeBean)pageContext.fi |ndAttribute("emp")).getTitle()))); | |One more thing. I walked through the code with the debugger and the |getter is being called in both instances. | |Any suggestion on where I should look? Any help would be appreciated. | |- Rich | |-- |To unsubscribe: <mailto:[EMAIL PROTECTED]> |For additional commands: <mailto:[EMAIL PROTECTED]> |Troubles with the list: <mailto:[EMAIL PROTECTED]> | | -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>
