You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Petri Rautakoski <pe...@utu.fi> on 2003/05/05 09:55:23 UTC

Re: [Exception in:..\layouts\defaultTemplate.jsp] null SOLVED!

There was some kind of problem finding that defaultTemplate.jsp page and when I started to point with absolute path it worked. Strange that it didn't work sameway in 3.3.1a and 4.1.24 Tomcats.

Petri

----- Original Message -----
From: Petri Rautakoski <pe...@utu.fi>
Date: Monday, May 5, 2003 9:35 am
Subject: [Exception in:..\layouts\defaultTemplate.jsp] null

> Hello!
> 
> I wrote about this exception earlier and I didn't got any answer, 
> so I'll try again. I have a very working application when I use 
> Tomcat 3.3.1a but when I'll try that application in Tomcat 4.1.18 
> or 4.1.24 it will throw this kind of exception information in browser:
> 
> [Exception in:..\layouts\defaultTemplate.jsp] null 
> 
> I followed the exception stacktrace and I found that the server 
> cannot find a context named 
> org.apache.struts.taglib.tiles.CompContext from the request,
> this method in org.apache.struts.taglib.tiles.InsertTag will 
> return null:
> 
> private ComponentContext getCurrentContext() {
>  if (cachedCurrentContext == null) {
>    cachedCurrentContext = (ComponentContext) 
> pageContext.getAttribute(    ComponentConstants.COMPONENT_CONTEXT, 
> pageContext.REQUEST_SCOPE);  }
>  return cachedCurrentContext;
> }
> 
> Method that called that former method was this method, of course 
> in the same class:
> 
> public TagHandler processAttribute(String name) throws 
> JspException {
>  Object attrValue = getCurrentContext().getAttribute(name);
> 
> Here comes the NullPointerException, because getCurrentContext() 
> returns null!!!!!
> 
>  if (attrValue == null)
>    throw new JspException("Error - Tag Insert : No value found 
> for attribute '" + name + "'."); 
>  return processObjectValue(attrValue);
> }
> 
> Here is my defaultTemplate.jsp
> 
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
> 
> <html:html>
> <head>
>  <title>Default application</title>
>  <link rel="stylesheet" href="..\css\default.css" type="text/css">
> </head>
> <body bgcolor="#E7EFF3" leftmargin="0" topmargin="0">
>    <table width="100%" height="100%" border="0" cellspacing="0" 
> cellpadding="0">      <tr>
>        <td height="120" colspan="2" 
> background="..\images\bank_top.jpg"> </td>
>      </tr>
>      <tr>
>        <td width="228" bgcolor="#152D2D" 
> valign="top"><tiles:insert attribute="menubar"/></td>
>        <td align="center" valign="top"><br><tiles:insert 
> attribute="body-content"/></td>
>      </tr>
>    </table>
> </body>
> </html:html>
> 
> And my definition JSP-page:
> 
> <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
> 
> <tiles:definition
>  id="default"
>  page="..\layouts\defaultTemplate.jsp"
>  scope="request">
>    <tiles:put name="menubar" value="..\public\menubar.jsp"/>
> </tiles:definition>
> 
> I think I have tried everything, please help me.
> Thank you!
> 
> Petri Rautakoski
> 
> 
> -------------------------------------------------------------------
> --
> 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