¡Hola! Soy nuevo en Struts y estoy haciendo una aplicación para gestionar autobuses. Lo que pasa es que cada vez que la intento ejecutar me sale la pantalla de 404, y por más que miro los ficheros de configuración no sé ya que hacer. Mi index.jsp está en WebContent. ¿Me podeis echar una mano?
Web.xml
Código XML:
Ver original<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" 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">
<display-name>Aplicacion Autobuses</display-name>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<servlet>
<servlet-name>StrutsServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>chainConfig</param-name>
<param-value>org/apache/struts/tiles/chain-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>StrutsServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
</welcome-file-list>
</web-app>
index.jsp
Código HTML:
Ver original<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<logic:redirect forward="welcome"/>
struts-config.xml
Código XML:
Ver original<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.3//EN"
"http://struts.apache.org/dtds/struts-config_1_3.dtd">
<struts-config>
<!-- ================================================ Form Bean Definitions -->
<form-beans>
<form-bean name="anyadirPersonaForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="nombreLike" type="java.lang.String" />
<form-property name="apellidoLike" type="java.lang.String" />
<form-property name="dniLike" type="java.lang.String" />
</form-bean>
</form-beans>
<!-- ========================================= Global Exception Definitions -->
<global-exceptions>
</global-exceptions>
<!-- =========================================== Global Forward Definitions -->
<global-forwards>
<forward name="welcome" path="/welcome.do" />
<forward name="/anyadirPersona" path="persona.anyadir" />
</global-forwards>
<!-- =========================================== Action Mapping Definitions -->
<action-mappings>
<action path="/welcome" forward="main.welcome" />
<action path="/anyadirPersona" type="com.app.actions.AnyadirPersonaAction"
parameter="reqCode" name="anyadirPersonaForm" scope="request"
validate="false" input="persona.anyadir">
<forward name="success" path="persona.anyadir" />
</action>
</action-mappings>
<controller
processorClass="org.springframework.web.struts.DelegatingTilesRequestProcessor" />
<!-- ======================================== Message Resources Definitions -->
<message-resources parameter="MessageResources" />
<!-- =============================================== Plug Ins Configuration -->
<plug-in className="org.apache.struts.tiles.TilesPlugin">
<set-property property="definitions-config" value="/WEB-INF/tiles-templates.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- =================================================== Validator plugin -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property property="pathnames"
value="/org/apache/struts/validator/validator-rules.xml,
/WEB-INF/validation.xml" />
</plug-in>
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/struts-actionbeans.xml" />
</plug-in>
</struts-config>
tiles-templates.xml
Código XML:
Ver original<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 1.3//EN"
"http://tiles.apache.org/dtds/tiles-config_1_3.dtd">
<tiles-definitions>
<definition name="main" template="/WEB-INF/jsp/tiles/main.jsp">
<put name="title" value="Default title" type="string" />
<put name="body" value="/WEB-INF/jsp/tiles/blank-body.jsp" />
<put name="footer" value="/WEB-INF/jsp/tiles/footer.jsp" />
</definition>
<definition name="persona.anyadir" extends="main">
<put name="title" value="Anyadir persona" />
<put name="body" value="/anyadirPersona.jsp" />
</definition>
</tiles-definitions>
¡Muchas gracias!