Hi,

I am (still!) trying to set up Tiles in my Struts app.
I am hoping to use Tiles definitions, but can't find any usable (working) simple examples to build from. Even the one at Cedric Dumoulin's site doesn't use this (best practice?) feature.
I have tried a 'cut n shut' from the stuff bundled with Struts to no avail.


As far as I can work out, to get Tiles working (with Struts already configured), you need to:

Add the following to web.xml:

<servlet> etc...
<init-param>
 <param-name>definitions-config</param-name>
 <param-value>/WEB-INF/tiles-defs.xml</param-value>
 </init-param>
</servlet>

<taglib>
 <taglib-uri>/WEB-INF/struts-tiles.tld</taglib-uri>
 <taglib-location>/WEB-INF/struts-tiles.tld</taglib-location>
</taglib>


Add the following to struts-config.xml:

<action path="/login" forward="fulluser"/>

<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml />
</plug-in>



I have the following in my tiles defs.xml file:

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


<tiles-definitions>
<definition name="fulluser" path="/tiles/layout.jsp">
 <put name="header" value="/tiles/header.jsp" />
 <put name="menu" value="/tiles/menu.jsp" />
 <put name="body" value="/tiles/body.jsp" />
 <put name="footer" value="/tiles/footer.jsp" />
</definition>
</tiles-definitions>

Then I invoke the action forward in a jsp file with the following:

<html:link page="/do/login">Login</html:link>

and get this...

java.lang.NullPointerException
        org.apache.struts.util.RequestUtils.pageURL(RequestUtils.java:1532)
        org.apache.struts.util.RequestUtils.computeURL(RequestUtils.java:487)
        org.apache.struts.taglib.html.RewriteTag.doStartTag(RewriteTag.java:99)
        org.apache.strutsel.taglib.html.ELRewriteTag.doStartTag(ELRewriteTag.java:291)
        org.apache.jsp.index_jsp._jspx_meth_html_rewrite_0(index_jsp.java:110)
        org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
        javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

All the webapp/tiles/*.jsp files are where they should be and the Struts stuff alone works OK.
I have tried adding the following to struts-config with the same result.
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"></controller>


I have also read somewhere that I may need an XML parser?

Can anyone spot anything obviously wrong or know of a simple up-to-date example?

Thanks,
Andy

_________________________________________________________________
It's fast, it's easy and it's free. Get MSN Messenger today! http://www.msn.co.uk/messenger



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to