hi all,
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(Str ing password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(Str ing username) {
this.username = username;
}
public void reset(ActionMap ping mapping, HttpServletRequ est request) {
this.username=n ull;
this.password=n ull;
}
}
[/CODE}
ActionLogin.jav a
login.jsp
struts-cfg.xml
Success.jsp page has
login.jsp and Success.jsp pages are in pages folder of webroot.
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...
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(Str ing password) {
this.password = password;
}
public String getUsername() {
return username;
}
public void setUsername(Str ing username) {
this.username = username;
}
public void reset(ActionMap ping mapping, HttpServletRequ est request) {
this.username=n ull;
this.password=n ull;
}
}
[/CODE}
ActionLogin.jav a
Code:
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");
}
}
Code:
<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>
Code:
<?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>
Code:
<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...
Comment