You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Elliot Long <el...@monkhouse.org.uk> on 2004/12/07 19:09:32 UTC
Struts with Tiles in the root context
I am having an odd problem. I've recently discovered how to setup
virtual hosts in tomcat so that i can use something like
"local.myapp.com" instead of "localhost/myapp". I've done this with two
apps. One works fine no problems, but the other (which uses Struts with
Tiles) comes up with a persistent error whenever a template is applied,
but only when it is referenced as the root context. So I made a new
template and scaled it down to the minimum and the problem remains.
Here are the relevant settings:
In server.xml:
<Engine name="Catalina" defaultHost="localhost" debug="0">
<Host name="local.synchro.com" appBase="webapps">
<Context path="" reloadable="true"
docBase="C:\Development\StartWebsite"
workDir="C:\Development\StartWebsite\work" />
<Context path="/synchro" reloadable="true"
docBase="C:\Development\StartWebsite"
workDir="C:\Development\StartWebsite\work" />
</Host>
</Engine>
The tiles definition in tiles-defs.xml:
<definition name="synchro.narf" path="/Templates/narf.jsp">
<put name="title" type="string">def title</put>
</definition>
/Templates/narf.jsp:
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<html:html>
<head>
<title><tiles:insert attribute="title"/></title>
</head>
<body>
Hello
</body>
</html:html>
narfPage.jsp:
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<tiles:insert definition="synchro.narf">
<tiles:put name="title" type="string">newer title</tiles:put>
</tiles:insert>
Now, if i access this page via
http://local.synchro.com/synchro/narfPage.jsp it comes up as expected,
no problems. However, if i try to access it through
http://local.synchro.com/narfPage.jsp it comes up with:
[ServletException in:/Templates/narf.jsp] null'
I'm at a complete loss. Any ideas?
--
-Elliot Long
Email/MSNm: elliot@monkhouse.org.uk
WWW: http://www.hypnotoad.co.uk
M: +34 666 057 523 (Esp)
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org