Hi All,
I was not able to call struts2 action from tiles 2 definition. Basically i'm calling index.jsp and that calls welcome.action. After welcome.action is done and suppose to call st2action.action (another
struts 2 action) from tiles definition but it is not. I'm getting following error message. Please see below information
The requested resource (/struts1/s2action) is not available
Thanks in advance,
Ramesh
web.xml
<web-app>
<filter>
<filter-name>webwork</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>webwork</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
.....
.....
</web-app>
index.jsp
<%@ page contentType="text/html" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<c:redirect url="http://localhost:8080/struts1/welcome.action"/>
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>
<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<package name="Webtest" extends="struts-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult"/>
</result-types>
<action name="st2action" class="com.action.st2Action" >
<result name="SUCCESS">/jsp/st2/st2.jsp</result>
</action>
<action name="welcome" class="com.action.welcome" >
<result name="SUCCESS" type="tiles">both</result>
</action>
</package>
</struts>
tiles.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
"http://tiles.apache.org/dtds/tiles-config_2_0.dtd">
<tiles-definitions>
<definition name="both" template="/jsp/st2/layout.jsp">
<put-attribute name="title" value="This is the title."/>
<put-attribute name="header" value="/jsp/header.jsp"/>
<put-attribute name="body" value="st2action.action"/>
<put-attribute name="footer" value="/jsp/footer.jsp"/>
</definition>
</tiles-definitions>
Env: Apache tomcat6/struts2.0.5/tiles 2.04