I am using Struts2. Below is my Action Class (TutorialAction
).
public class TutorialAction {
public String execute() {
System.out.println("Hello from Execute!");
return "failure";
}
}
I am returning "failure"
in execute method of this Action class.
Below are my 2 struts config files :
======================== struts.xml ================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" namespace="/tutorials" extends="struts-default">
<action name="getTutorial" class="com.tushar.action.TutorialAction">
<result name="failure">/ErrorPage.jsp</result>
</action>
</package>
<include file="struts2.xml"></include>
</struts>
In above config file I am including another struts config file(struts2.xml
) for same namespace :
======================== struts2.xml ================================
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">
<struts>
<package name="default" namespace="/tutorials" extends="struts-default">
<action name="getTutorial" class="com.tushar.action.TutorialAction">
<result name="failure">/SuccessPage.jsp</result>
</action>
</package>
</struts>
My project is running fine. I am just curious to know if included file in struts.xml
(which is struts2.xml
) is run after main struts.xml
or before ?
Or what would be the output: /SuccessPage.jsp
or /ErrorPage.jsp
?