struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Reddin <gred...@apache.org>
Subject Re: Tiles without Struts
Date Wed, 09 Nov 2005 14:17:33 GMT

On Nov 8, 2005, at 9:23 PM, Paul Benedict wrote:

> I have gone to this link:
> http://struts.apache.org/struts-tiles/installation.html
>
> I am looking for those 3 WAR files listed but I can't find them.  
> The link in this paragraph is
> broken so I can't get to the distribution: "First, download a  
> binary distribution of Tiles by
> following the instructions <<--here-->>. Then, make sure you have  
> downloaded and installed the
> prerequisite software packages described above."
>
> Someone needs to fix the website.

The website is out of date.  I'm in the process of fixing it in svn  
but haven't copied it over to the site directory yet - maybe today?   
Those .war files are not being built anymore.

You should be able to configure the Tiles Servlet like this:

<servlet>
       <servlet-name>Tiles Servlet</servlet-name>
       <servlet-class>org.apache.struts.tiles.servlets.TilesServlet</ 
servlet-class>
       <init-param>
          <param-name>definitions-config</param-name>
          <param-value>/WEB-INF/tiles-defs.xml</param-value>
       </init-param>
       <load-on-startup>1</load-on-startup>
    </servlet>

>
> In any event, I want to know if anyone has used Tiles without  
> Struts. If you're doing the XML
> method, I know you need a controller in the middle to decide which  
> Tile to load. So that's really
> Struts or Spring. Has anyone done that? Just wanting to know.

You don't have to use a controller servlet.  You can insert a tile  
from a JSP.  It's not pretty, but here's how it might be done:

In tiles-defs.xml

<definition name="main" path="/mailLayout.jsp">
   ....
   <put name="body" value="/body.jsp"/>
</definition>

<definition name="child" extends="main">
     <put name="body" value="/aPage.jsp"/>
</definition>


In your web app you'd have the following JSPs:

/mainLayout.jsp
/body.jsp
/aPage.jsp
/aPageTiles.jsp


/aPageTiles.jsp would look like this:

<tiles:insert definition="child"/>

Then you would link to /aPageTiles.jsp.  I know this isn't elegant,  
but it works.  I'm looking at better ways to do this sort of thing  
with Standalone Tiles using a Filter or something.

HTH,
Greg


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


Mime
View raw message