Doesn't look like you have the S2 Tiles plugin anywhere.

http://struts.apache.org/2.x/docs/tiles-plugin.html

<http://struts.apache.org/2.x/docs/tiles-plugin.html>Without it there is no
way for S2 to know what a tiles result actually *means*. Once S2 knows what
Tiles even is, you still need to set up a default result type, or define
results as being "tiles" results.

Dave

On Mon, Nov 22, 2010 at 11:50 AM, John Dondapati <djohnji...@gmail.com>wrote:

> Hi,
>
> I am very new to Struts 2 and really want to use it in a project at work.
> We have Struts 2, Spring 2.5.6 working peacefully together and I wanted to
> add Tiles 2.2 on to the stack to experiment with it.
>
> I have added all the dependencies in the maven and they are all available.
> I am following the instructions on the Apache Tiles website and created a
> Listener and everything. But somehow the result type is not recognized by
> Struts 2. I tried posting it on the Tiles user list and they advised me to
> try here.
>
> Did anyone have a similar problem? How did you get around it? Also, it was
> suggested that Tiles 2.2 does not work with Struts 2. Is that true? Should I
> use Tiles 2.0.7 instead?
>
>
> Here's my configuration :
>
> *Environment* :
>
> Tomcat 6.0.29
> Java(TM) SE Runtime Environment (build 1.6.0_22-b04-307-10M3261)
>
>
>
> *My web.xml **:*
> *
> *
> <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>
>
>     <listener>
>
>  
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>     </listener>
> *
> *
> * <listener>*
> *        <listener-class>com.blablabla.MyTilesListener</listener-class>*
> * </listener>*
>
>
> *Here's my /WEB-INF/tiles.xml*
> *
> *
> *   <definition name="doc.mainLayout"
> template="/tiles/layout/classicLayout.jsp">*
> *      <put-attribute name="title"  value="Electronic Submission of
> Medical Documentation (esMD)" />*
> *      <put-attribute name="header" value="/tiles/layout/tiles-header.jsp"
> />*
> *      <put-attribute name="body"   value="/tiles/layout/tiles-body.jsp"
> />*
> *      <put-attribute name="footer" value="/tiles/layout/tiles-footer.jsp"
> />*
> *    </definition>*
> *    *
> *    <definition name="LoginPage" extends="doc.mainLayout">*
> *        <put-attribute name="body" value="/tiles/LoginBody.jsp"/>*
> *    </definition>*
> *
> *
> *My struts.xml*
> *
> *
> *
> <package name="default" namespace="/" extends="struts-default"> <!--
> "tiles-default" package cannot be found in tiles 2.2 so I changed it -->
>       <action name="Login">
> *
> *
>                  <result>LoginPage</result>
>       </action>
> </package>
>
> *
>
> *MyTilesListener*
>
> public class MyTilesListener extends AbstractTilesListener {
>
>     protected TilesInitializer createTilesInitializer() {
>     return new MyCustomTilesInitializer();
> }
> }
>
> *MyCustomTilesInitializer*
>
> public class MyCustomTilesInitializer extends BasicTilesInitializer {
>
>         /** {...@inheritdoc} */
>         @Override
>         protected AbstractTilesContainerFactory createContainerFactory(
>                 TilesApplicationContext context) {
>             return new MyTilesContainerFactory();
>         }
> }
>
> *MyTilesContainerFactory*
>
> public class MyTilesContainerFactory extends BasicTilesContainerFactory{
> @Override
> protected List<URL> getSourceURLs(TilesApplicationContext
> tilesApplicationContext,
> TilesRequestContextFactory tilesRequestContextFactory) {
>
> List<URL> urls = null;
>
> try {
> urls = new ArrayList<URL>();
>
> urls.add(tilesApplicationContext.getResource("/WEB-INF/tiles.xml"));
>  } catch(Exception exception) {
>
> }
>
> return urls;
>  }
>
> }
>
> *This is the error we get: *
> *
> *
> *
> HTTP Status 404 - /LoginPage
> ------------------------------
>
> type Status report
>
> message /LoginPage
>
> description The requested resource (/LoginPage) is not available.
> ------------------------------
> Apache Tomcat/6.0.29
> *
>
> *ServerLog * :
>
> 388 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
> org.apache.tiles.context.AbstractTilesApplicationContextFactory -
> Initializing Tiles2 application context. . .
> 392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN
> org.apache.tiles.context.ChainedTilesApplicationContextFactory - Cannot find
> TilesContextFactory class
> org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
> 392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
> org.apache.tiles.context.AbstractTilesApplicationContextFactory - Finished
> initializing Tiles2 application context.
> 392 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] WARN
> org.apache.tiles.context.ChainedTilesApplicationContextFactory - Cannot find
> TilesContextFactory class
> org.apache.tiles.portlet.context.PortletTilesApplicationContextFactory
> 449 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] INFO
> org.apache.tiles.access.TilesAccess - Publishing TilesContext for context:
> org.apache.tiles.servlet.context.ServletTilesApplicationContext
>
>
> Can someone give me a direction to fix this please. Thanks!
>
>
> --
> Cheers,
> John
>
> P.S: I also attached my pom.xml dependencies to give you a complete
> picture.
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

Reply via email to