Hi everyone,
I am new to this
struts. I have a samll application to check login. When I run my application I get this message in my server console
No getter method for property user of bean org.apache.struts.taglib.html.BEAN
I saw the previous forum for the same topic. I have checked my property names start with appropriate cases. Here is my code
%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html>
<head><title>Login</title></head>
<body>
<html:form action="submit.do">
<table width="100%" border="0" height=75%>
<tr>
<td align="right" >UserName: </td>
<td><html:text property="user"/></td>
<tr>
<tr>
<td align="right" >Password: </td>
<td><html:text property="password"/></td>
</tr>
<tr>
<td colspan=2 align="center"><html:submit/></td>
</tr>
<tr>
<td colspan=2 align="center"><html:errors/></td>
</tr>
</table>
</html:form>
</body>
</html>
import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
import java.util.*;
/**
* @author skannan
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>
Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class LoginForm extends ActionForm
{
private
String user = null;
private String password = null;
/* user */
public String getUser()
{
return (this.user);
}
public void setUser(String user)
{
this.user = user;
}
/* password */
public String getPassword()
{
return (this.password);
}
public void setPassword(String password)
{
this.password = password;
}
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// Log the forms data
servlet.log("Lastname:" + user);
servlet.log("Address:" + password);
// Check for mandatory data
ActionErrors errors = new ActionErrors();
if (user == null || user.equals("")) {
errors.add("User", new ActionError("error.user"));
}
if (password == null || password.equals("")) {
errors.add("Password", new ActionError("error.password"));
}
return errors;
}
}
I am missing anything in my config files. Please I need help.
Thanks!