** Funny thing about ActionForm bean getters/setters **
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   joey_corleon
Posted On:   Thursday, January 22, 2004 12:55 PM

Hi, In one of my actionForms, I have the following :- private int anInterger = -1; private String aString = ""; [...] public int getAnInterger() { return anInterger; } public void setAnInterger(int anInterger) { this.anInterger = anInterger; } public void setAString(String aString) { this.aString = aString; } public String getAString() { return aString; } So I am expecting, in my JSP to retrieve these properties using struts tags as follows:- a nInterger" /> a String" />    More>>

Hi,


In one of my actionForms, I have the following :-


			
private int anInterger = -1;
private String aString = "";

[...]

			
public int getAnInterger() {
return anInterger;
}
public void setAnInterger(int anInterger) {
this.anInterger = anInterger;
}
public void setAString(String aString) {
this.aString = aString;
}
public String getAString() {
return aString;
}


So I am expecting, in my JSP to retrieve these properties using struts tags as follows:-



			
a nInterger" />
a String" />


However, this produces the error:-


			
javax.servlet.ServletException: No getter method for property aString of bean org.apache.struts.taglib.html.BEAN


Now, if I rename the tag rendering the sting as follows (an only this one!):-



			
a nInterger" />
A String" />


Notice the **CAPITAL** 'A' of "AString" , it works fine.


So, How come I have to set a capital 'A' for A Sting, and not for " a nInteger"?!



Thanks!

   <<Less

Re: ** Funny thing about ActionForm bean getters/setters **

Posted By:   Christopher_Koenigsberg  
Posted On:   Friday, January 23, 2004 06:50 AM

I also found, as you did, that it gets weird if you have a property name starting with two or more consecutive capital letters in it. I try to avoid that now (rename it to "TheString" or whatever as long as it no longer starts with 2 consecutive capital letters in the property name!).

About | Sitemap | Contact