You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Raphaël di Cicco <ra...@atosorigin.com> on 2003/04/16 13:26:59 UTC
simple tiles definition struts 1.1
Hi,
I am trying to make a tiles on my main page called main.jsp. This is what I
put in my tile-defs.xml file, in the same dir as struts-config.xml :
<!DOCTYPE tiles-definitions PUBLIC
"-//Apache Software Foundation//DTD Tiles Configuration//EN"
"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<!-- Tiles definitions -->
<tiles-definitions>
<definition name="main" path="main.jsp">
<put name="title" value="Example de Tiles" />
<put name="header" value="/header.jsp" />
<put name="footer" value="/footer.jsp" />
<put name="body" value="/body.jsp" />
</definition>
</tiles-definitions>
And then I configure the plug-in in struts-config.xml
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tile-defs.xml"/>
</plug-in>
Finally I use this code in my main.jsp page :
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<hmtl:html>
<head>
<title><tiles:getAsString name="title"/></title>
</head>
<body>
<tiles:insert beanName="main" flush="true" />
</body>
</html:html>
When I launch Tomcat I get messages that the tiles are loaded with the
plug-in, but once I try to display the page I get this exception :
org.apache.jasper.JasperException: Error - tag.getAsString : component
context is not defined. Check tag syntax
I check my tag syntax but I don't see what's wrong or missing. Help greatly
appreciated
Raphael
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: simple tiles definition struts 1.1
Posted by Cedric Dumoulin <ce...@lifl.fr>.
Hi,
If you access directly your main.jsp page, you don't have any tile
context, and so no tile attribute defined.
To have the tiles attribute defined, you need to insert your tile with
<tiles:insert name="main.jsp" /> or with a struts action.
Also, to insert a definition, you need to write <tiles:insert
name="defName" />
There is some good articles around the net to help starting with
Tiles. Try a search, it will really help you (ok, I know, I should
reference them in the doc, this will be done soon ...).
Cedric
Raphaël di Cicco wrote:
>Hi,
>
>I am trying to make a tiles on my main page called main.jsp. This is what I
>put in my tile-defs.xml file, in the same dir as struts-config.xml :
>
><!DOCTYPE tiles-definitions PUBLIC
>"-//Apache Software Foundation//DTD Tiles Configuration//EN"
>"http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
><!-- Tiles definitions -->
><tiles-definitions>
><definition name="main" path="main.jsp">
><put name="title" value="Example de Tiles" />
><put name="header" value="/header.jsp" />
><put name="footer" value="/footer.jsp" />
><put name="body" value="/body.jsp" />
></definition>
></tiles-definitions>
>
>And then I configure the plug-in in struts-config.xml
>
><plug-in className="org.apache.struts.tiles.TilesPlugin" >
><set-property property="definitions-config" value="/WEB-INF/tile-defs.xml"/>
></plug-in>
>
>Finally I use this code in my main.jsp page :
><%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
><hmtl:html>
><head>
><title><tiles:getAsString name="title"/></title>
></head>
><body>
><tiles:insert beanName="main" flush="true" />
></body>
></html:html>
>
>When I launch Tomcat I get messages that the tiles are loaded with the
>plug-in, but once I try to display the page I get this exception :
>org.apache.jasper.JasperException: Error - tag.getAsString : component
>context is not defined. Check tag syntax
>
>
>I check my tag syntax but I don't see what's wrong or missing. Help greatly
>appreciated
>
>Raphael
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org