This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply.

Well I have created a formbean (fields of all jsp) and configure my struts-config.xml file as:



multipleform.jsp is as:



multipleform1.jsp is as:



UserRegistrationForm is as:


The following is the url...
http://localhost/multipleform.jsp

When I click on the Submit button of this form the following page opens

url is :
http://localhost/multipleform1.jsp

And it gives me the following error:

says......



I don't know where I am going wrong well as I have created a form bean in which there are set and get methods of all jsps.

Answer Please...

Please reply soon.

Thanks in advance..
 
dnyan ginde
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I dont know whether i am right or not, but i think you should try putting the <table> tag after the <html:form> tag in both your jsp's. Please try it and let me know if it works.
 
dnyan ginde
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
After going through the code i find no problem at all. Even the <table> tag before the <form> tag should work. Try initialising ename to null in your reset method. Please let me know if you find out what the problem was.
 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Thanks for your prompt reply.

>> I dont know whether i am right or not, but i think you should try putting the <table> tag after the <html:form> tag in both your jsp's. Please try it and let me know if it works.

Well that's not the problem. I have checked it.

>> After going through the code i find no problem at all. Even the <table> tag before the <form> tag should work. Try initialising ename to null in your reset method. Please let me know if you find out what the problem was

I have initialise ename to null also but the problem is same.
I am getting the same problem.....

Please reply.

Thanks
 
dnyan ginde
Ranch Hand
Posts: 68
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Harish,the possible problem could be with your nameing standards in the case of ename.The property ename is not according to the java beans naming standards. Try changing the property name. In your case (ename) the letter e cannot be considered to be a word. try changing ename to userName or something like that.
 
shahin Khan
Greenhorn
Posts: 17
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think u have not used the getter and setter methods for the hidden property page i have found this as missing in ur formbean add and try once again and let me know
even i am beginner in struts
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remove attribute="user" from your <action > tag in your struts-config.xml file. It has the effect of nullifying the association between your form bean and your action.
 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Even after changing ename to userAge it doesn't work.
I am getting the same problem. not rectify.

here is the UserRegistrationForm (formbean)
-----------------------
package multipleform;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import javax.servlet.http.HttpServletRequest;

public class UserRegistrationForm extends ActionForm {

private String firstName;
private String lastName;
private String userName;
private String password;
private String passwordCheck;
private String email;
private String phone;
private String fax;
private String userAge;
private boolean registered;

public UserRegistrationForm() {

}

public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}

public String getEmail() {
return this.email;
}
public void setEmail(String email) {
this.email = email;
}

public String getLastName() {
return this.lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}

public String getUserName() {
return this.userName;
}
public void setUserName(String userName) {
this.userName = userName;
}

public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}

public String getPasswordCheck() {
return this.passwordCheck;
}
public void setPasswordCheck(String passwordCheck) {
this.passwordCheck = passwordCheck;
}

public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}

public String getFax() {
return this.fax;
}
public void setFax(String fax) {
this.fax = fax;
}

public String getUserAge() {
return this.userAge;
}
public void setUserAge(String userAge) {
this.userAge = userAge;
}

public boolean getRegistered() {
return this.registered;
}
public void setRegistered(boolean registered) {
this.registered = registered;
}



public void reset(ActionMapping mapping,
HttpServletRequest request) {
firstName=null;
lastName=null;
userName=null;
password=null;
passwordCheck=null;
email=null;
phone=null;
fax=null;
userAge=null;
registered=false;
}

private String[] defaultValues ={ firstName, lastName, userName, password,passwordCheck,email,phone,fax };

public boolean isMissing(String value) {
if ((value == null) || (value.trim().equals(""))){
return(true);
} else {
for(int i=0; i<defaultValues.length; i++) {
if (value.equals(defaultValues[i])) {
return(true);
}
}
return(false);
}
}

}
----------------------
multipleform1.jsp is as:

------------------------
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<html>
<head>
<title>User Registration</title>
</head>
<body>
<h1>User Registration</h1>
<html:errors/>
<table>
<html:form action="/userRegistration1">
<tr>
<td>
Emp Name:
</td>
<td>
<html:text property="userAge"/>
</td>
</tr>
<tr>
<td>
<html:submit/>
</td>
<td>
<html:cancel/>
</td>
</tr>
</html:form>
</table>
</body>
</html>
---------------------

Please reply soon.

Thanks
 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also please tell me whether the architecture and coding that I am using is correct / fine or not?

Thanks

Harish Pathak
 
harish pathak
Ranch Hand
Posts: 51
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well Thanks to all for your responses.

I have solved my problem.
It was my mistake,nothing technical but human error.

But please have a look into the cade and
please tell me whether the architecture and coding that I am using is correct / fine or not?

Thanks

Harish Pathak
 
jf inthemix
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Harish!
I'm having the same problem, and probably I'm doing the same human mistake...
can you tell me wich was your mistake please??
 
shilpa tendulkar
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This link is quiet useful for common struts errors
http://www.geocities.com/Colosseum/Field/7217/SW/struts/errors.html
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic