aspose file tools*
The moose likes Struts and the fly likes No getter method for property finame of bean org. apache. struts. taglib. html. BEAN Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "No getter method for property finame of bean org. apache. struts. taglib. html. BEAN" Watch "No getter method for property finame of bean org. apache. struts. taglib. html. BEAN" New topic
Author

No getter method for property finame of bean org. apache. struts. taglib. html. BEAN

satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Hello ,
I have gone through a search for similar exceptions in this forum and found quite a few people who seem to have faced the same
Well I too am facing the same problem !
I am using Weblogic 6.1 and here is the basic code for JSP :

In my formBean here is the code for the variable declarations & getters setters:

This form bean contains the other methods : ie validate & reset
In my action class I am simply returning a forward
When I put a System.out.println statement in reset I can see it getting executed - but always get the exception related to the getter
I have spent hours and hours in fcat two days on this and I do not seem to understand where I am going wrong
I have checked that the formBean is defined correctly in the struts config and that I am making use of the same form bean in the action mapping
This form bean is in request scope.
I also tried and deleted the browser cache & the .wlnotdelete directory in weblogic
Here is what I get on weblogic console :
javax.servlet.jsp.JspException: No getter method for property finame of bean org.apache.struts.taglib.html.BEAN
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi,
this is the way i usually write set and get method for my field properties
in the jsp file
String strBtype;
String strBname;

public void setStrBtype(String btype)
{
this.strBtype=btype;
}
public String getStrBtype()
{
return this.strBtype;
}
just try his .
All the best
satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Thanks for the reply
I am still getting the same exception
satish pune
Ranch Hand

Joined: Sep 04, 2003
Posts: 44
Ok - I need to clarify and this is something which looks really strange OR
maybe I have not really understood how struts works .
This doesnt have anything to do with the getters or the setters
Ok let me explain the mistake ( is this a mistake ? ) that I made
Here is the code once again :
To get to my first page I enter the following URL :
http://localhost:7001/L/M/N
Now this is mapped in the Struts config as :


JSP Code :

Here is what is happening :
When I am trying to reach the first page using the URL :
http://localhost:7001/L/M/N
The problem is that in my JSP page I have specified a form action :
action path="/L/M/N"
This action path is defined in the " struts config .xml " but the form
bean thatis mapped against this is some different form !!!
It seems that even though I am invoking page "createEmployee.jsp"
( for which the form bean has the correct getters and setters )
the framework internally is looking up the mapping that I have
specified in the form action in the jsp ( /A/B/C )
This is why I was getting this No getter exception
On putting the corresponding getters & setters in this new form what I
observe is that I get the page with no exceptions
The funny part is that the new form bean's reset method does not
get called but the getters do get invoked
( I had put some System.out.println statements in this form bean )
After putting System outs everywhere this is the series
in which statements get fired :
( when I am trying to access the page "createEmployee.jsp" )
The form bean "EmpForm" reset method gets invoked
It then ignores the reset method of the form bean : " NewForm "
It however calls the getters "getFiname" & "getFiage" of form : " NewForm "
It ignores getters of form " EmpForm " ( which I expected to be called )
Maybe I have not understood the struts framework in totality
but what I can conclude is that when I try to access a page and am using a
form bean then the same form bean should be mapped against the html:form
action ( JSP ) in struts-config.xml
This is after a lot of effort that I have come up with the reasons
Forgive me for the long mail but I hope other people will find it useful
and not have to spend time on similar problems
Thanks Poornima for your inputs .
-satish
[ December 18, 2003: Message edited by: satish pune ]
[ December 18, 2003: Message edited by: satish pune ]
poornima balagopal
Ranch Hand

Joined: Dec 02, 2003
Posts: 83
Hi.
once more i am giving a try to solve your problem. now my answer is also a bit lengthy. anyway try this.
Let your jsp will be employee.jsp which is written as
--------------------------------------------------------------------------
<html:html>
<head/>
<body>
<html:form action="/login">
<html:text property="strEmployeename"/>
<html:submit value="submit"/>
</html:form>
</body>
</html:html>
------------------------------------------------------------------------------------------------------------
lets assume that you have ActonForm class(formbean class) named EmpForm with all the get and set method for the properties you are specifying for the fields in jsp and aslo take EmpAction be you action class for this JSP
now in the configuration file
you will map formbean and action classes as followes
------------------------------------------------------------------------------------------------------------
<form-beans>
<form-bean name="EmpForm" type="EMPForm"/>
</form-beans>
<action-mappings>
<action path="/login" type="EmpAction" name="EmpForm" scope="request" validate="false">
<forward name="success" path="newEmployee.jsp"/>
</action>

</action-mappings>
-------------------------------------------------------------------------------------------------------------
This is the way you have to map . In the form bean mapping the type should be the name of the FormBean class (what you are giving at the time of creating the java file). name can be anything you want. but that should match with the name in the action mapping for that jsp page. In the action mapping whatever you are giving as path for that particular jsp page it also should match with the form action you are giving in the jsp page.

Hope this time i can solve your problem
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: No getter method for property finame of bean org. apache. struts. taglib. html. BEAN