Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JspException: No getter method

 
Sam Shen
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I've a problem in using struts bean tag.
When I ran the following jsp file:
jsp file:..........
<logic:iterate id="element" name="items">
<li><bean:write name="element" property="name" /> <<---- this line causes problem
</logic:iterate>
result:...........
javax.servlet.jsp.JspException: No getter method for property name of bean element
at org.apache.struts.util.RequestUtils.lookup(RequestUtils.java:742)
at org.apache.struts.taglib.bean.WriteTag.doStartTag(WriteTag.java:290)

"items" is a hashtable in session.
When I use the following code:
<%
Hashtable hitems= (Hashtable)session.getAttribute("items");
for (Enumeration e = hitems.elements(); e.hasMoreElements(); ){
WatchItem witem = (WatchItem)e.nextElement();
%>
<%=witem.getName() %>
<%
}
%>
I can get each property from items's element.
Can you give me some help?
Many Thanks,
Sam
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64827
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the Struts forum.
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic