i got a problem with struts.
iam unable to find it.
i have written an action class, form bean class and a jsp page
on submitting form, request is going to action class but it is not executing action class iam unable to solve it...
here is my code
FormLogin.java
[code]
public class FormLogin extends ActionForm{
private String username=null;;
private String password=null;;
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
this.username=null;
this.password=null;
}
}
[/CODE}
ActionLogin.java
Expand|Select|Wrap|Line Numbers
- public class ActionLogin extends Action {
- public ActionForward execute(HttpServletRequest req, HttpServletResponse res,
- ActionForm form, ActionMapping mapping)throws Exception
- {
- System.out.println("this is action class");
- FormLogin fl=(FormLogin)form;
- System.out.println(fl.getUsername());
- System.out.println(fl.getPassword());
- return mapping.findForward("success");
- }
- }
Expand|Select|Wrap|Line Numbers
- <html:form action="/login">
- <html:text property="username">username</html:text>
- <html:password property="password">password</html:password>
- <html:submit>submit</html:submit>
- </html:form>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="UTF-8"?>
- <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
- <struts-config>
- <form-beans>
- <form-bean
- name="FormLogin"
- type="com.yourcompany.struts.FormLogin"/>
- </form-beans>
- <global-exceptions />
- <action-mappings>
- <action
- path="/login"
- type="com.yourcompany.struts.ActionLogin"
- name="FormLogin"
- scope="request"
- validate="true"
- input="/Pages/login.jsp">
- <forward name="success" path="/Pages/Success.jsp"/>
- </action>
- </action-mappings>
- <message-resources parameter="com.yourcompany.struts.AppllicationResources" />
- </struts-config>
Expand|Select|Wrap|Line Numbers
- <body>
- success fully login
- </body>
when i send request to login.jsp form was displayed but when i will submit the form it is not going to success.jsp blank page is coming..
the request will be like this when i submit form
http://localhost:8080/StrutsApp/login.do
how can i solve it...