This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes javax.servlet.jsp.JspException: No getter method for property: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm"" Watch "javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm"" New topic
Author

javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm"

Vish Murthy
Greenhorn

Joined: Jan 09, 2010
Posts: 6
[code]

Hi,

I am getting an error "javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm" can any one help please. I am pasting my code

struts-config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">


<struts-config>


<!-- ================================================ Form Bean Definitions -->

<!-- ================================================ Form Bean Definitions -->

<form-beans>

<form-bean
name="LoginForm" type="Login.LoginForm" >
</form-bean>

</form-beans>



<!-- ========================================= Global Exception Definitions -->

<global-exceptions>
<!-- sample exception handler
<exception
key="expired.password"
type="app.ExpiredPasswordException"
path="/changePassword.jsp"/>
end sample -->

</global-exceptions>


<!-- =========================================== Global Forward Definitions -->

<global-forwards>

<!-- <forward name="/login" path="/jsp/login.html" /> -->
</global-forwards>


<!-- =========================================== Action Mapping Definitions -->

<action-mappings>

<action path="/loginPage" validation="false" input="/index.jsp" name="LoginForm" type="Login.LoginAction" parameter="method">
<forward name="success" path="/Jsp/MainPage.jsp" />
</action>

</action-mappings>


<!-- ======================================== Message Resources Definitions -->

<!-- <message-resources parameter="com.heb.operations.odc.pat.resources.ApplicationResources" /> -->


<!-- =================================================== Validator plugin -->

<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/org/apache/struts/validator/validator-rules.xml,
/WEB-INF/validation.xml"/>
</plug-in>

</struts-config>



index.jsp

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<%@ page language="java" %>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-layout.tld" prefix="layout" %>


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

<html:form action="/loginPage" method="post">
<table align="center">
<tr>
<td><B>Mini Project</B> </td>
</tr>
</table>


<table align="center">

<tr>
<td> Login </td>
<td>
<html:text property="id"> </html:text>
</td>
</tr>
<tr>
<td>Password </td>
<td><html:text property= "pass"> </html:text></td>
</tr>

<tr>
<td></td>
<td>
<html:submit>Submit</html:submit>
</td>

</table>
</html:form>
</body>
</html>


FORM


package Login;

import org.apache.struts.action.ActionForm;


public class LoginForm extends ActionForm{

private String id ;
private String pass;
private String errorDesc;

public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public String getErrorDesc() {
return errorDesc;
}
public void setErrorDesc(String errorDesc) {
this.errorDesc = errorDesc;
}
}


ACTION

package Login;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.actions.DispatchAction;

public class LoginAction extends DispatchAction{


public ActionForward vlidateLogin(ActionMapping mapping,
ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
{

System.out.println("Test");
return mapping.findForward("success");

}

}



[/code]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60791
    
  65

Please be sure to use code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information.

You can go back and change your post to add code tags by clicking the button on your post.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
 
subject: javax.servlet.jsp.JspException: No getter method for property: "id" of bean: "Login.LoginForm"
 
Similar Threads
Problem with logic:present tag
web container displaying jsp intead of html
ServletException in:/pages/logon.jsp] Cannot retrieve definition for form bean null'
help with login program
Problem with logic:present