Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP using Bean

 
Subramaniam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am a method of the Bean but some how it is failing to recognize just one method of the bean. When I comment that line in my JSP it runs fine. I have checked the names, parameters etc but it is not working ? help required urgently !!
 
Sarath Mohan
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Please check your Beans Function naming.
if should follow rules getter and setter functions.
For example if you want to set or get a String varible named 'myVariable'
then na
ming should be
public void setMyVarible(String str)
and
public String getMyVariable(String str)
OK
 
Subramaniam
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First thanx for the help. I have set & get method as u said. Do the parameters to call the method have to be the same. ie.
int a;
String b;
public void setMyvar(int i, String s){
this.a=i;
this.b=s;
}
public String getMyvar(String s){
return b;
}
once again thanx
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Subramaniam",
The Java Ranch has thousands of visitors every week, many with surprisingly similar names. To avoid confusion we have a naming convention, described at http://www.javaranch.com/name.jsp . We require names to have at least two words, separated by a space, and strongly recommend that you use your full real name. Please log in with a new name which meets the requirements.
Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic