| Author |
Struts module problem
|
Ingoba Ningthoujam
Ranch Hand
Joined: Dec 04, 2006
Posts: 90
|
|
Hi All, I have a small application in Struts using module. I have only only one module(xyz). In the index.jsp page, I have two links. One goes to module (xyz). But when I click on that link I got Error. HTTP Status 404 - /xyz-page1.jsp type Status report message /xyz-page1.jsp description The requested resource (/xyz-page1.jsp) is not available. in the Browser. I am using Tomcat5.0. My code is as follows: 1) index.jsp <%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> <html:html xhtml="true"> <head> <title><bean:message key="indexpage.title"/></title> <html:base/> <link rel="stylesheet" href="css/struts-training.css" charset="ISO-8859-1" type="text/css"/> </head> <body background="images/blueAndWhiteBackground.gif"> <br/><br/><br/><br/><br/> <div align="center"> <html:link page="/showCustomerSearchForm.do"><bean:message key="indexpage.linktext"/></html:link> <br/><br/><br/><br/><br/> <html:link forward="gotoXYZModule">Go to XYZ Module</html:link> </div> </body> </html:html> 2) web.xml <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> <web-app> <display-name>Hello World Struts Application</display-name> <listener> <listener-class>struts.example.util.ApplicationScopeInit</listener-class> </listener> <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>config/xyz</param-name> <param-value>/WEB-INF/struts-config-xyz.xml</param-value> </init-param> <init-param> <param-name>debug</param-name> <param-value>3</param-value> </init-param> <init-param> <param-name>detail</param-name> <param-value>3</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>/WEB-INF/struts-html.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri> <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location> </taglib> <!-- The JSTL and Struts-EL tlds --> <taglib> <taglib-uri>/WEB-INF/struts-bean-el.tld</taglib-uri> <taglib-location>/WEB-INF/struts-bean-el.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-html-el.tld</taglib-uri> <taglib-location>/WEB-INF/struts-html-el.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/struts-logic-el.tld</taglib-uri> <taglib-location>/WEB-INF/struts-logic-el.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/c.tld</taglib-uri> <taglib-location>/WEB-INF/c.tld</taglib-location> </taglib> <taglib> <taglib-uri>/WEB-INF/pager-taglib.tld</taglib-uri> <taglib-location>/WEB-INF/pager-taglib.tld</taglib-location> </taglib> </web-app> 3) struts-config.xml <!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="CustomerSearchForm" type="struts.example.search.CustomerSearchForm" /> <form-bean name="ManageCustomersForm" type="struts.example.search.ManageCustomersForm" /> <form-bean name="CustomerForm" type="struts.example.CustomerForm" /> </form-beans> <global-exceptions> <exception key="error.database.customer.save" type="struts.example.customer.CustomerServiceException" path="/DatabaseError.jsp" /> <exception key="error.database.fetch.customersummary" type="struts.example.customer.list.CustomerListServiceException" path="/DatabaseError.jsp" /> </global-exceptions> <global-forwards> <forward name="mainpage" path="/index.jsp" /> <forward name="gotoXYZModule" path="/switch.do?page=/page1.do&prefix=/xyz" /> </global-forwards> <action-mappings> <action path="/switch" type="org.apache.struts.actions.SwitchAction"/> <action path="/showCustomerSearchForm" parameter="/CustomerSearchList.jsp" type="org.apache.struts.actions.ForwardAction" /> <action path="/submitCustomerSearchForm" type="struts.example.search.CustomerSearchAction" name="CustomerSearchForm" scope="session" validate="true" input="/CustomerSearchList.jsp"> <forward name="success" path="/CustomerSearchList.jsp" /> </action> <action path="/manageCustomerList" type="struts.example.search.ManageCustomersAction" name="ManageCustomersForm" scope="request" validate="true" input="/CustomerForm.jsp"> <forward name="deleteSuccess" path="/submitCustomerSearchForm.do" /> <!-- Action Chaining --> <forward name="add" path="/showCustomerForm.do?action=Create" /> <!-- Action Chaining with multiple entry points --> </action> <action path="/showCustomerForm" type="struts.example.ShowCustomerAction" parameter="action" scope="request"> <forward name="customerFormPage" path="/CustomerForm.jsp" /> </action> <action path="/submitCustomerForm" type="struts.example.CustomerAction" name="CustomerForm" scope="request" validate="true" input="/CustomerForm.jsp"> <exception key="error.database.customer.duplicate" type="struts.example.customer.dao.DuplicateCustomerException" handler="struts.example.DuplicateCustomerExceptionHandler"/> <forward name="gotoSearchPage" path="/submitCustomerSearchForm.do" /> </action> <action path="/customerlist" parameter="/CustomerSearchList.jsp" type="org.apache.struts.actions.ForwardAction" /> </action-mappings> <controller processorClass="org.apache.struts.action.RequestProcessor" /> <message-resources parameter="struts.example.MessageResources" null="false" /> <message-resources parameter="struts.example.ImageResources" key="bundle.image" null="false" /> </struts-config> 4) struts-config-xyz.xml <!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-beans> <global-forwards> <forward name="gotoDefaultModule" path="/switch.do?page=/showCustomerSearchForm.do&prefix=" /> </global-forwards> <action-mappings> <action path="/switch" type="org.apache.struts.actions.SwitchAction"/> <action path="/page1" parameter="/xyz-page1.jsp" type="org.apache.struts.actions.ForwardAction" /> <action path="/page2" parameter="/xyz-page2.jsp" type="org.apache.struts.actions.ForwardAction" /> </action-mappings> <controller processorClass="org.apache.struts.action.RequestProcessor" /> <message-resources parameter="struts.example.XYZMessageResources" null="false" /> </struts-config> I am having the module folder xyz in the application. Please help me.
|
 |
Ingoba Ningthoujam
Ranch Hand
Joined: Dec 04, 2006
Posts: 90
|
|
|
Anybody please help....
|
 |
 |
|
|
subject: Struts module problem
|
|
|