Normally you make your <servlet-mapping> <url-pattern> *.do instead of /project661/*
and your form action would be /project661/registration.do or just /registration.do and your struts action mapping path would just be /registration Hope this helps. B. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: 11 January 2006 03:28 To: CTJUG Forum Subject: [CTJUG Forum] Struts and Tomcat webapp problem Hi there, I am having some diffiulty with this simple struts app(ah the irony). I am able to get the web application to load from the URL http://127.0.0.1/project661 and the form presented. However when I hit the submit button in the form I get a 404 from the URL http://127.0.0.1/project661/registration Now I have looked at a few examples with the struts- resume project from appfuse and I can't see anything that I am doing drasticly different from it. The struts action mapping does match the value in the ACTION attribute of the form. The <servlet-mapping> in should pickup /project661/registration. My suspision is that it concerns the tomcat configuration. I have not really altered the sever xml. I have supplied a context.xml with the webapp and this is being picked up since the I can see the access log in the $CATALINA_HOME/logs being generated. Do I require a <Host> element in my context.xml or should the <Host name="localhost"> in server.xml suffice? Any help greatly appreciated :-) Version info : struts - 1.2.8 tomcat - 5.5.12 jdk - 1.5.0_03 web.xml : <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4"> <display-name>Project661</display-name> <distributable/> <servlet> <servlet-name>action</servlet-name> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> <init-param> <param-name>config</param-name> <param-value>/WEB-INF/struts-config.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>99</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>9</param-value> </init-param> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>action</servlet-name> <url-pattern>/project661/*</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app> struts-config.xml : <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd"> <struts-config> <form-beans> <form-bean name="registrationform" type="za.co.tradecraft.project661.form.RegistrationForm" /> </form-beans> <action-mappings> <action path="/project661/registration" type="za.co.tradecraft.project661.action.RegistrationAction" name="registrationform" scope="request" input="/registration.jsp" unknown="false" validate="true"> <forward name="success" path="/registration_success.jsp" redirect="false"/> <forward name="failure" path="/registration.jsp" redirect="false" /> </action> </action-mappings> </struts-config> context.xml : <Context debug="9" antiResourceLocking="true" swallowOutput="true" docbase="webapps/project661" path="/project661" reloadable="true"> <Logger className="org.apache.catalina.logger.FileLogger" prefix="project661_log." suffix=".txt" timestamp="true"/> <Resource name="jdbc/project661" auth="Container" type="javax.sql.DataSource"/> <ResourceParams name="jdbc/project661"> <parameter> <name>factory</name> <value>org.apache.commons.dbcp.BasicDataSourceFactory</value> </parameter> <parameter> <name>maxActive</name> <value>100</value> </parameter> <parameter> <name>maxIdle</name> <value>30</value> </parameter> <parameter> <name>maxWait</name> <value>10000</value> </parameter> <parameter> <name>username</name> <value>developer</value> </parameter> <parameter> <name>password</name> <value>youmustbejoking</value> </parameter> <parameter> <name>driverClassName</name> <value>com.mysql.jdbc.Driver</value> </parameter> <parameter> <name>defaultAutoCommit</name> <value>true</value> </parameter> <parameter> <name>url</name> <value>jdbc:mysql://127.0.0.1:3306/project661</value> </parameter> <parameter> <name>removeAbandoned</name> <value>true</value> </parameter> <parameter> <name>removeAbandonedTimeout</name> <value>60</value> </parameter> <parameter> <name>logAbandoned</name> <value>true</value> </parameter> </ResourceParams> </Context> registration.jsp : <FORM ACTION="/project661/registration" METHOD="POST"> <TABLE BORDER="0" ALIGN="left" BGCOLOR="#000000" WIDTH="50%"> <TR> <TD class="tableheadingrow"><SPAN CLASS="tableheading">Member Registration</SPAN></TD> </TR> <TR> <TD> <TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFCC66"> <TR> <TD WIDTH="30%"> <SPAN CLASS="inputlabel">Name:</SPAN> </TD> <TD> <INPUT TYPE="text" NAME="registration.member.name"> </TD> </TR> <TR> <TD WIDTH="30%"> <SPAN CLASS="inputlabel">Surname:</SPAN> </TD> <TD> <INPUT TYPE="text" NAME="registration.member.surname"> </TD> </TR> <TR> <TD WIDTH="30%"> <SPAN CLASS="inputlabel">E-Mail Address:</SPAN> </TD> <TD> <INPUT TYPE="text" NAME="registration.member.emailaddress"> </TD> </TR> <TR> <TD WIDTH="30%"> <SPAN CLASS="inputlabel">Gender:</SPAN> </TD> <TD> <INPUT TYPE="text" NAME="registration.member.gender"> </TD> </TR> <TR> <TD WIDTH="30%"> <SPAN CLASS="inputlabel">Password:</SPAN> </TD> <TD> <INPUT TYPE="password" NAME="registration.member.password"> </TD> </TR> </TABLE> </TD> </TR> <TR> <TD> <TABLE BORDER="0" WIDTH="100%" BGCOLOR="#FFCC66"> <TR> <TD ALIGN="center" COLSPAN="2"><INPUT TYPE="Submit" VALUE="Register"></TD> </TR> </TABLE> </TD> </TR> </TABLE> </FORM> This e-mail and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this e-mail in error please notify NSFAS immediately. Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of the organisation.
