Then you must be using an old pre-Struts version of Tiles. Sorry but I can't help you there.

David



From: Vernon <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
CC: [EMAIL PROTECTED]
Subject: Re: Please help a Tiles problem
Date: Sat, 05 Apr 2003 22:26:07 -0800


Where the plug-in configuration shall go? I don't use Struts, but Tiles only. According to the document on tiles-documentation.war, the TilesServlet shall be used, if my understanding is correct.


On Sat, 05 Apr 2003 16:45:59 -0700, David Graham <[EMAIL PROTECTED]> wrote:

I noticed in your debug output that you're using TilesServlet. Are you using Struts 1.1? You don't need the TilesServlet; all you need is to configure the TilesPlugin.

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

David


From: Vernon <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: Struts Users Mailing List <[EMAIL PROTECTED]>
Subject: Re: Please help a Tiles problem
Date: Sat, 05 Apr 2003 15:23:14 -0800


I start getting quite frustrated on this issue after a few days of researching on the Tiles home page, Tiles Struts home page, Struts email archive, the tiles-documentation.war, and google on Tiles. The whole development is stop at this point.


I have read somewhere at the email archive: it is not need to process the initialition if the definition is stored in a JSP file, which is the case I posted my previous post.

I change the definition method, using a xml file instead. After having a xml file and modification of web.xml, I get the logging message when I start/reload the applicaiton:

8242 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n
FactorySet.java:301) - definitions={FRONT={name=FRONT, path=/jsp/templates/mmSig
nUpLayout.jsp, role=null, controller=null, controllerType=null, controllerInstan
ce=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, header=/
jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}}
}
8282 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n
FactorySet.java:305) - factory loaded : {FRONT={name=FRONT, path=/jsp/templates/
mmSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerI
nstance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, hea
der=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}}
}
8292 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n
FactorySet.java:269) - default factory:{FRONT={name=FRONT, path=/jsp/templates/m
mSignUpLayout.jsp, role=null, controller=null, controllerType=null, controllerIn
stance=null, attributes={footer=/jsp/homepage/footer.jsp, title=Front Page, head
er=/jsp/signon/header.jsp, body=/jsp/frontpage/content.jsp}}
}
8302 DEBUG [main] org.apache.struts.tiles.xmlDefinition.I18nFactorySet (I18n
FactorySet.java:217) - Factory initialized from file '/WEB-INF/tiles- defs.xml'.
8312 INFO [main] org.apache.struts.tiles.TilesServlet (TilesServlet.java:1
17) - Tiles Factory successfully loaded


The definition seems in place. However, when I point to the url of a page, I get the following error messages:

java.lang.NullPointerException
at org.apache.struts.taglib.tiles.InsertTag.processName(InsertTag.java:527)
at org.apache.struts.taglib.tiles.InsertTag.createTagHandler(InsertTag.java:486)
at org.apache.struts.taglib.tiles.InsertTag.doStartTag(InsertTag.java:444)
at org.apache.jsp.page_jsp._jspx_meth_tiles_insert_0(page_jsp.java:73)
at org.apache.jsp.page_jsp._jspService(page_jsp.java:52)
...


And in the translated JSP Java file, there is

public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {


JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;


try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out;

out.write("\r\n\r\n");
if (_jspx_meth_tiles_insert_0(pageContext))   <======= line 52
return;
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}

private boolean _jspx_meth_tiles_insert_0(javax.servlet.jsp.PageContext pageContext)
throws Throwable {
JspWriter out = pageContext.getOut();
/* ---- tiles:insert ---- */
org.apache.struts.taglib.tiles.InsertTag _jspx_th_tiles_insert_0 = (org.apache.struts.taglib.tiles.InsertTag) _jspx_tagPool_tiles_insert_name_flush.get(org.apache.struts.taglib.tiles.InsertTag.class)




;
_jspx_th_tiles_insert_0.setPageContext(pageContext);
_jspx_th_tiles_insert_0.setParent(null);
_jspx_th_tiles_insert_0.setName("FRONT");
_jspx_th_tiles_insert_0.setFlush(true);
int _jspx_eval_tiles_insert_0 = _jspx_th_tiles_insert_0.doStartTag();
if (_jspx_th_tiles_insert_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return true;
_jspx_tagPool_tiles_insert_name_flush.reuse(_jspx_th_tiles_insert_0);
return false;
}


If my understanding is right, the definition of "FRONT" can be found. The JSP file have the following two lines:

<%@ taglib uri='/WEB-INF/tlds/struts-tiles.tld' prefix='tiles' %>

<tiles:insert name="FRONT" flush="true" />

What is missing here?


On Fri, 04 Apr 2003 07:01:55 -0800, Vernon <[EMAIL PROTECTED]> wrote:



Thanks very much for your information, Cedric.


I have read through the Tiles related articles linked to the Struts- Tiles page, and have not seen the plug in procedure for standalone usage. A plugin procedure, I find, is on the following page http://www.onjava.com/pub/a/onjava/excerpt/progjakstruts_14/index2.html.



It is about Struts. I don't use Struts however. How I initialize the Tiles?


On Fri, 04 Apr 2003 10:12:48 +0200, Cedric Dumoulin <[EMAIL PROTECTED]> wrote:



The error message says that the definition factory is not found. Have you initialized the tile plugin ?


Cedric

Vernon wrote:

1. The error message:

root cause

javax.servlet.ServletException: Can't get definitions factory from context.
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)








at org.apache.jsp.page_jsp._jspService(page_jsp.java:189)

2. The translated JSP file

public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {


JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;


try { _jspxFactory = JspFactory.getDefaultFactory(); response.setContentType("text/html;charset=ISO-8859-1"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out;

out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
if (_jspx_meth_c_if_0(pageContext))
return;
out.write("\r\n");
if (_jspx_meth_c_if_1(pageContext))
return;
// ...
out.write("\r\n");
if (_jspx_meth_c_if_37(pageContext))
return;
out.write("\r\n\r\n\r\n\r\n\r\n\r\n\r\n");
out.write("\r\n\r\n");
if (_jspx_meth_tiles_insert_0(pageContext))
return;
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t); <---- line 189
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
3. The JSP file with the definitions


<%@ taglib prefix="tiles" uri="/WEB-INF/tlds/struts-tiles.tld" %>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld" %>

<c:if test="${empty applicationScope.FRONT}">
<tiles:definition id="FRONT" template="/jsp/templates/myLayout.jsp">
<put name="title"  value="Front Page" />
<put name="header" value="/jsp/signon/header.jsp" />
<put name="footer" value="/jsp/homepage/footer.jsp" />
<put name="body"   value="/jsp/frontpage/content.jsp" />
</tiles:definition>
</c:if>
<c:if test="${empty applicationScope.SIGNON}">
<tiles:definition id="SIGNON" extends="FRONT">
<put name="title"  value="Sign On" />
<put name="body"   value="/jsp/signon/content.jsp" />
</tiles:definition>
</c:if>
<!--

....
-->

If I erase all defintions, but keep the first one, the attributes wouldn't loaded.

The Tiles is from http://www.lifl.fr/~dumoulin/tiles/.

I don't have any JSP debugging tool. Can someone please tell me where is wrong or how to find out the cause.

Vernon

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




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








-- Vernon

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



_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail



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





-- Vernon


_________________________________________________________________
Tired of spam? Get advanced junk mail protection with MSN 8. http://join.msn.com/?page=features/junkmail



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



Reply via email to