tiles-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Dondapati <djohnji...@gmail.com>
Subject Re: Tiles 2 and Struts 2
Date Mon, 22 Nov 2010 17:00:23 GMT
@ Antonio - Yes, you are right I thought it was provided in the tiles jar
along with the "tiles-default" package. But looks like it's been changed in
2.2. I posted it on struts user list, let's see what they have to say.
Thanks!


On Mon, Nov 22, 2010 at 11:32 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> Probably you are missing the Tiles result type for Struts 2. For this,
> you have to ask the Struts users mailing list:
> http://struts.apache.org/mail.html
>
> Antonio
>
> 2010/11/22 John Dondapati <djohnjimmy@gmail.com>:
> > Hi,
> > I am very new to Apache Tiles 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. 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.
>



-- 
Cheers,
John

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message