struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Antonio Sánchez <inganto...@gmail.com>
Subject Actions as welcome files
Date Fri, 31 May 2013 18:17:53 GMT
Hello.

My name is Antonio, I'm beginning with Struts2 and this is my first post.

Where should store struts.xml if I need to use an action as a welcome file?

In example "Hello World" (maven):

http://struts.apache.org/development/2.x/docs/hello-world-using-struts-2.html

I have to move struts.xml (originally inside resources folder) inside 
maven 'main' folder to make it work and avoid

     HTTP 404 - There is no Action mapped for namespace [/] and action 
name [] associated with context path [/Hello_World_Struts2_Mvn].

but then struts.xml is unreachable in Netbeans project window.

In this crud example:

http://struts.apache.org/development/2.x/docs/hello-world-using-struts-2.html

I can't find the right way. I have updated libs to the latest ones. 
struts.xml is in WEB-INF/classes in war file deployed by Netbeans 
(Tomcat 7).

Bellow struts and web xmls

<struts>
     <!-- Include webwork default (from the Struts JAR). -->
     <include file="struts-default.xml"/>

     <!-- Configuration for the default package. -->
     <package name="default" extends="struts-default">

         <!-- Default interceptor stack. -->
         <default-interceptor-ref name="paramsPrepareParamsStack"/>
         <action name="index" 
class="com.aurifa.struts2.tutorial.action.EmployeeAction" method="list">
             <result name="success">/WEB-INF/jsp/employees.jsp</result>
             <!-- we don't need the full stack here -->
             <interceptor-ref name="basicStack"/>
         </action>
         <action name="crud" 
class="com.aurifa.struts2.tutorial.action.EmployeeAction" method="input">
             <result name="success" type="redirectAction">index</result>
             <result name="input">/WEB-INF/jsp/employeeForm.jsp</result>
             <result name="error">/WEB-INF/jsp/error.jsp</result>
         </action>
     </package>
</struts>


<web-app>
     <display-name>Struts 2 Demo</display-name>

     <welcome-file-list>
         <welcome-file>index.action</welcome-file>
     </welcome-file-list>

     <filter>
         <filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
     </filter>

     <filter-mapping>
         <filter-name>struts2</filter-name>
         <url-pattern>/*</url-pattern>
     </filter-mapping>
</web-app>

Thanks.




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message