S
sonali
Hi
I tried running my first struts example but got stuck with the HTTP 404 error.
description:The requested resource (/actions/register1.do) is not available. I am using tomcat 4.1.29 and struts 1.1.
I kept struts.jar in my classpath. Struts.jar is also present in the lib dir of my web appl.
The following is the source code.
struts-config.xml
<struts-config>
<action-mappings>
<action path="/actions/register1"
type="coreservlets.RegisterAction1">
<forward name="success"
path="result1.jsp"/>
</action>
</action-mappings>
</struts-config>
register1.jsp
<HTML>
<HEAD><TITLE>New Account Registration</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>New Account Registration</H1>
<FORM ACTION="../actions/register1.do" METHOD="POST">
Email address: <INPUT TYPE="TEXT" NAME="email"><BR>
Password: <INPUT TYPE="PASSWORD" NAME="password"><BR>
<INPUT TYPE="SUBMIT" VALUE="Sign Me Up!">
</FORM>
</CENTER>
</BODY></HTML>
RegisterAction1.java
package coreservlets;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class RegisterAction1 extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return(mapping.findForward("success"));
}
}
result1.jsp
<HTML>
<HEAD><TITLE>Success</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>You have registered successfully.</H1>
(Version 1)
</CENTER>
</BODY></HTML>
I kept the java class under classes/coreservlets dir. I used the web.xml file which comes under struts-blank.war and made no changes to it.
What went wrong? Please let me know.
I tried running my first struts example but got stuck with the HTTP 404 error.
description:The requested resource (/actions/register1.do) is not available. I am using tomcat 4.1.29 and struts 1.1.
I kept struts.jar in my classpath. Struts.jar is also present in the lib dir of my web appl.
The following is the source code.
struts-config.xml
<struts-config>
<action-mappings>
<action path="/actions/register1"
type="coreservlets.RegisterAction1">
<forward name="success"
path="result1.jsp"/>
</action>
</action-mappings>
</struts-config>
register1.jsp
<HTML>
<HEAD><TITLE>New Account Registration</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>New Account Registration</H1>
<FORM ACTION="../actions/register1.do" METHOD="POST">
Email address: <INPUT TYPE="TEXT" NAME="email"><BR>
Password: <INPUT TYPE="PASSWORD" NAME="password"><BR>
<INPUT TYPE="SUBMIT" VALUE="Sign Me Up!">
</FORM>
</CENTER>
</BODY></HTML>
RegisterAction1.java
package coreservlets;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class RegisterAction1 extends Action {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception {
return(mapping.findForward("success"));
}
}
result1.jsp
<HTML>
<HEAD><TITLE>Success</TITLE></HEAD>
<BODY BGCOLOR="#FDF5E6">
<CENTER>
<H1>You have registered successfully.</H1>
(Version 1)
</CENTER>
</BODY></HTML>
I kept the java class under classes/coreservlets dir. I used the web.xml file which comes under struts-blank.war and made no changes to it.
What went wrong? Please let me know.