Problem with Action Mappings in Chps. 19-20
Hello,
I'm using the sample web application in Chps. 19-20 as a guide for creating my own application. I'm having a problem getting the Action Mappings to work correctly.
I'm getting a 404 - Servlet action is not available error when I try to load my app. I've configured the pages and web.xml/struts-config.xml as demonstrated in the book.
Can anyone point me in the right direction? Below are some details from my config files...
The default page (index.jsp) has two lines. I know I'm getting to this point b/c when I change the tags I get different error messages:
<%@ taglib uri="/logic" prefix="logic" %>
<logic:redirect href="home.do"/>
My web.xml is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>application</param-name>
<param-value>PartDBResources</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>dbInit</servlet-name>
<servlet-class>util.DBInitServlet</servlet-class>
<init-param>
<param-name>driverClass</param-name>
<param-value>org.gjt.mm.mysql.Driver</param-value>
</init-param>
<init-param>
<param-name>jdbcURL</param-name>
<param-value>jdbc:mysql://localhost:3306/partnerships</param-value>
</init-param>
<init-param>
<param-name>minCount</param-name>
<param-value>1</param-value>
</init-param>
<init-param>
<param-name>maxCount</param-name>
<param-value>10</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/bean</taglib-uri>
<taglib-location>/web-inf/struts-bean.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/html</taglib-uri>
<taglib-location>/web-inf/struts-html.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/logic</taglib-uri>
<taglib-location>/web-inf/struts-logic.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>/template</taglib-uri>
<taglib-location>/web-inf/struts-template.tld</taglib-location>
</taglib>
</web-app>
My struts-config.xml file is:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config
PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="entityForm" type="base.Entity"/>
</form-beans>
<action-mappings>
<action path="/home"
type="Actions.HomeAction"
unknown="true">
<forward name="Success" path="/home.jsp"/>
</action>
</action-mappings>
</struts-config>
Any help would be greatly appreciated.
Thanks,
Mike
|