AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Struts issue... "No getter method for property..."

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help
View previous topic :: View next topic  
Author Message
goa_head
Guest





PostPosted: Sat Apr 24, 2004 11:13 pm    Post subject: Struts issue... "No getter method for property..." Reply with quote



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">
<bean:write name="forums" property="forumName"/>

</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!
Back to top
Ryan Stewart
Guest





PostPosted: Sun Apr 25, 2004 12:27 pm    Post subject: Re: Struts issue... "No getter method for property..." Reply with quote



"goa_head" <goa_head (AT) verizon (DOT) net> wrote

Quote:
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:

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

</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.



Back to top
Andrew Thompson
Guest





PostPosted: Sun Apr 25, 2004 12:52 pm    Post subject: Re: Struts issue... "No getter method for property..." Reply with quote



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

Quote:
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
tag.

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

Sudsy commented on the 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.

Quote:
..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.infosystems.www.authoring.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

Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.