You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by log2akshat <ak...@iiitmk.ac.in> on 2011/04/27 15:08:25 UTC

Facing an issue trying to use Struts 2.0.14 with Tiles 2.0.

Hi,

I am very new to Struts 2. 
I am having problem using Struts 2.0.14 with Tiles 2.0. 

When I insert the following information in my web.xml I get an exception: 

<listener> 
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class> 
</listener>

Stacktrace:
27 Apr, 2011 6:14:57 PM org.apache.tiles.impl.BasicTilesContainer init
INFO: Initializing Tiles2 container. . .
27 Apr, 2011 6:14:57 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
27 Apr, 2011 6:14:57 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/INAT] startup failed due to previous errors
27 Apr, 2011 6:14:57 PM org.apache.tiles.access.TilesAccess setContainer
INFO: Removing TilesContext for context:
org.apache.catalina.core.ApplicationContextFacade

I have the following jars: 
struts2-tiles-plugin-2.0.14.jar 
tiles-api-2.0.4.jar 
tiles-core-2.0.4.jar 
tiles-jsp-2.0.4.jar

Finally my application INAT is not running when using the Tiles and when I
am removing the listner from the web.xml file the application successfully
loads but I want to use Tiles in my application. My configuration files are
as under:

1. web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_9" 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>INAT</display-name>
 
 <listener>
	
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
	</listener>
	<context-param>
	
<param-name>org.apache.tiles.impl.BasicTilesContainer.DEFINITIONS_CONFIG</param-name>
		<param-value>/WEB-INF/tiles.xml</param-value>
	</context-param>
	
 <filter>
  <filter-name>struts2</filter-name>
 
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
 </filter>
 
 <filter-mapping>
  <filter-name>struts2</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>
 
 <welcome-file-list>
  <welcome-file>/pages/Welcome.jsp</welcome-file>
 </welcome-file-list>
 
 <error-page>
  <error-code>404</error-code>
  <location>/pages/Errors/error404.jsp</location>
 </error-page>
 
</web-app>


2. tiles.xml
<?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE tiles-definitions PUBLIC
       &quot;-//Apache Software Foundation//DTD Tiles Configuration
2.0//EN&quot;
       &quot;http://tiles.apache.org/dtds/tiles-config_2_0.dtd&quot;&gt;
<tiles-definitions>
	<definition name="baseLayout" template="/BaseLayout.jsp">
		<put-attribute name="title" value="" />
		<put-attribute name="header" value="/Header.jsp" />
		<put-attribute name="menu" value="/Menu.jsp" />
		<put-attribute name="body" value="" />
		<put-attribute name="footer" value="/Footer.jsp" />
 
	</definition>
	<definition name="/welcome.tiles" extends="baseLayout">
		<put-attribute name="title" value="Welcome page" />
		<put-attribute name="body" value="/pages/Welcome.jsp" />
	</definition>
	<definition name="/error.tiles" extends="baseLayout">
		<put-attribute name="title" value="Error page" />
		<put-attribute name="body" value="/Error.jsp" />
	</definition>
</tiles-definitions>


3. struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
&lt;!DOCTYPE struts PUBLIC
&quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quot;
&quot;http://struts.apache.org/dtds/struts-2.0.dtd&quot;&gt;

<struts>

<constant name="struts.enable.DynamicMethodInvocation" value="false" />
<constant name="struts.devMode" value="true" />
<constant name="struts.custom.i18n.resources" value="ApplicationResources"
/>

<package name="INAT" namespace="/Candidate" extends="struts-default">

<result-types>
			<result-type name="tiles"
				class="org.apache.struts2.views.tiles.TilesResult" />
		</result-types>
		
<action name="Welcome">
<result name="success" type="tiles">/welcome.tiles</result>
</action>

<action name="doLogin" class="net.Candidate.Login">
<result name="input">/pages/login.jsp</result>
<result name="error">/pages/login.jsp</result>
<result>/pages/loginsuccess.jsp</result>
</action>


</package>




</struts>


4. Welcome.jsp
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>

<html>
<head>
<title>Welcome Page - INAT 2011</title>
</head>
<body>
<ul>
<li> Candidate/Welcome.action Login Application </li>
</ul>
</body>
</html>

Please Help.........


--
View this message in context: http://struts.1045723.n5.nabble.com/Facing-an-issue-trying-to-use-Struts-2-0-14-with-Tiles-2-0-tp4343587p4343587.html
Sent from the Struts - User mailing list archive at Nabble.com.

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