You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Pedro-1 <pi...@hotmail.fr> on 2007/04/06 11:43:45 UTC

Struts2 and Tiles, still not clear for me :(

Hi, I'm new in Struts, and bought the complete reference (second edition) to
start with it.
I discovered that Struts2 is different, and begin to understand how to
develop some struts2 on Eclipse.
Now, my problem is that I am completly lost with Tiles, and
http://struts.apache.org/2.x/docs/tiles-plugin.html does not help me.
It seem's that in the previous version of struts, it was mandatory to
declare struts as a <plug-in ...> within struts-config.xml, and now as a
listener within web.xml. But within the doc of
org.apache.struts2.views.tiles.TilesResult they say that it must be declared
as a servlet.... I am lost :(
Could some one give me a pointer to a simple example (without other things
like freemaker)  showing all the configuration files, and where to put them?
Thanks in advance for your help




-- 
View this message in context: http://www.nabble.com/Struts2-and-Tiles%2C-still-not-clear-for-me-%3A%28-tf3535994.html#a9869976
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


Re: Struts2 and Tiles, still not clear for me :(

Posted by Pedro-1 <pi...@hotmail.fr>.
Many thanks Dave Newton-4, 
I understand better how it works with the different configuration files :)


-- 
View this message in context: http://www.nabble.com/Struts2-and-Tiles%2C-still-not-clear-for-me-%3A%28-tf3535994.html#a9871359
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


Re: Struts2 and Tiles, still not clear for me :(

Posted by Dave Newton <ne...@yahoo.com>.
--- Pedro-1 <pi...@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