struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dave Newton <newton.d...@yahoo.com>
Subject Re: Struts2 and Tiles, still not clear for me :(
Date Fri, 06 Apr 2007 10:40:33 GMT
--- Pedro-1 <pierre_leplus@hotmail.fr> wrote:
> Could some one give me a pointer to a simple example
> showing all the configuration files, and where to
put
> them?

-- web.xml fragment

<!-- 
  - If you want to use tiles config files other
  - than the default /WEB-INF/tiles.xml you can
  - configure them with a context-param.
  -
  - This is optional but I think it helps a lot.
  -->
<context-param>
  <param-name>definitions-config</param-name>
  <param-value>
    /WEB-INF/tiles.xml,
    /WEB-INF/classes/com/foo/bar/bar-tiles.xml,
    /WEB-INF/classes/com/foo/baz/baz-tiles.xml
  </param-value>
  <description>
    CSV list of Tiles 2.0 configuration files.
  </description>
</context-param>

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

-- tiles.xml fragment

<?xml version="1.0" encoding="ISO-8859-1" ?>

<!DOCTYPE tiles-definitions PUBLIC
    "-//Apache Software Foundation//DTD Tiles
Configuration 2.0//EN"
   
"http://struts.apache.org/dtds/tiles-config_2_0.dtd">

<tiles-definitions>
  <definition name="/sanityCheck.page"
template="/WEB-INF/jsp/sanityCheck.jsp">
    <put name="title" value="Sanity Check"/>
  </definition>

  <definition name="layout"
template="/WEB-INF/jsp/components/layout.jsp">
    <put name="title" value="!!! DEFAULT TITLE !!!" />
  </definition>

  <definition name="/home.page" extends="layout">
    <put name="title" value="Home" type="string" />
    <put name="body" value="/WEB-INF/jsp/home.jsp" />
  </definition>

  <!-- Etc. -->
</tiles-definitions>

-- layout.jsp (just to show insertions of attributes)

<%@ taglib prefix="tiles"
uri="http://struts.apache.org/tags-tiles"%>
<html>
  <head>
    <title><tiles:getAsString name="title"/></title>
  </head>
  <body>
    <tiles:insertAttribute name="body" />
  </body>
</html>

d.



 
____________________________________________________________________________________
Don't get soaked.  Take a quick peek at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather

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


Mime
View raw message