For Programmers: Free Programming Magazines  


Home > Archive > Java Help > April 2004 > Re: Struts issue... "No getter method for property..."









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Struts issue... "No getter method for property..."
Ryan Stewart

2004-04-25, 9:31 am

"goa_head" <goa_head@verizon.net> wrote in message
news:2a41bac8.0404241513.6d4c6ef3@posting.google.com...
> I've seen this problem posted a lot and have recently ran into it.
> Trying the various suggestions hasn't worked...
>
> I have an ArrayList which gets put into the Session object by one of
> my classes via session.setAttribute. The ArrayList is populated with
> various "Forum" objects. I try to iterate through the arraylist with
> this on a JSP:
>
> <logic:iterate id="forums" name="forumList">
> <tr><td colspan=2><FONT face="Verdana" size="-2">
> <b><bean:write name="forums" property="forumName"/></b><br>
> </td></tr>
> </logic:iterate>
>
> That makes me get the "No getter method for property forumName of bean
> forums" error. If I remove the bean:write statement and replace it
> with static text, the text gets repeated for the number of items on
> the ArrayList, so I *know* it's looping through the objects. It's just
> not seeing getForumName().
> The arraylist is composed of various "Forum" objects these look like
> the following:
> ------------------------------
> public class Forum {
>
> //Variable declarations
> private String forumName;
>
> /** Creates a new instance of Forum */
> public Forum(String newForumName) {
> this.forumName= newForumName;
> } //end Forum
>
> public String getForumName() {
> return this.forumName;
> } //end getForumName
>
> public void setForumName(String newForumName) {
> this.forumName = newForumName;
> } //end setForumName
> } //end class Forum
> -------------------------
>
> Any ideas? Any help would be appreciated!


My first idea is to use JSTL. The Struts designers recommend using the
standard taglib anywhere that the functionality overlaps. In JSTL, that
iterate would be:

<c:forEach var="forums" items="${forumList}">
<tr><td colspan=2><FONT face="Verdana" size="-2">
<b><c:out value="${forums.forumName}" /></b><br>
</td></tr>
</c:forEach>

My next idea would be to add a close tag for that font tag, followed
immediately by removing the font tag and b tag since they're deprecated. But
this isn't an HTML forum. Other than that I can't help you much. I don't use
logic:iterate for the reason I mentioned above.


Andrew Thompson

2004-04-25, 9:33 am

On Sun, 25 Apr 2004 07:27:17 -0500, Ryan Stewart wrote:

> <c:forEach var="forums" items="${forumList}">
> <tr><td colspan=2><FONT face="Verdana" size="-2">
> <b><c:out value="${forums.forumName}" /></b><br>
> </td></tr>
> </c:forEach>
>
> My next idea would be to add a close tag for that font tag, followed
> immediately by removing the font tag and b tag since they're deprecated.


...not to mention the redundant <br> tag.

I think that it is a good idea to remove the lot.

Sudsy commented on the <font> tag and the OP
responded to the effect 'tried it - did not work'
but that left me wonderring if they had given
it proper nesting (given the <b> tag as well)
and if incorrect parsing of the HTML might
contribute to the wider problem.

So _my_ recommendation ot the OP is..
see it fail as

.....
<tr><td colspan=2>
<c:out value="${forums.forumName}" />
</td></tr>
.....

Before you do anything else.

That test should hopefuly rule out the HTML
tags as contributing to it.

> ..But this isn't an HTML forum.


The effects can the OP wants can be attained
using stylesheets and the EXACT code above..

Check here for further details..
<http://google.com/groups?group=comp...ing.stylesheets>

Wonderful things.

[ F'Ups to c.l.j.help ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com