aspose file tools*
The moose likes Struts and the fly likes error: No getter method for property Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "error: No getter method for property" Watch "error: No getter method for property" New topic
Author

error: No getter method for property

Dave Jamz
Greenhorn

Joined: Sep 29, 2012
Posts: 8
Hi I am trying to use struts to get a bean to my jsp code the bean I am using in my jsp page is: <bean:write name="unitForm" property="testData.team.type" /> but whenever I run the jsp I am receiving No getter method for property: "testData.team.type" of bean: "unitForm". I am trying to write baseball to my jsp page.

the code for my action form is:



testing data class has:


and finally in my sport class:




Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Hi Dave,
What struts framework does for us is if you mention it tries to fetch value of testData.team.type from "unitform" type object in the scope mentioned using the getter method. As the error clearly mentions "No getter method" that means your it is considering the whole property as a single one and trying to call something like getTestData.team.type() method. You have two ways to get out of it
1. If you are using only struts and no EL
define the team object and then get the value, example -
2. If you are using struts-el, include the definitions in your view file and do whatever you have already done- do not forget the syntax


Have Fun with Java
little,little.. little by little makes a lot..
Dave Jamz
Greenhorn

Joined: Sep 29, 2012
Posts: 8
Hi I tried



inside of the jsp and still received the error:

No getter method for property: "type" of bean: "teamObj"

I also tried



and got:

javax.servlet.ServletException: javax.servlet.jsp.JspException: No getter method for property: "" of bean: "unitForm"
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Sorry Dave,
I overlooked at your post... "team" is just a String and and it is trying to do getType() from your "team" which doesnt exists. You need to simple do Here, since TestGettingData extends Sport it should be able to get the value from parent class.
Hope you are understanding what is happening, Understanding the problem is more important sometimes than solving it just like that

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: error: No getter method for property
 
Similar Threads
Simple EL code is not working
No getter method for property
Struts: No getter method for property: "check" of bean: "teamPlayers" problem
No getter method for bean write in Struts
form:options tag cause error : Bean property is not readable or has an invalid getter method