You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Daniel Haynes <da...@rulefinancial.com> on 2002/10/08 16:16:22 UTC

newbie tiles question

I get an error when trying to display a simple JSP using Tiles:
- org.apache.jasper.JasperException: Error - Tag Insert : No value defined
for bean 'forteus.default' with property 'null' in scope 'request'.
 I don't fully understand what is happening, or indeed what is meant to
happen... Does something need to be done in the action class (before
forwarding to this JSP) to define this bean (forteus.default) or is there
something missing in my setUp/config ?
Any light shed on this would be appreciated ?
Dan
(below are the files)



This is the JSP that is throwing the error: (home.jsp)
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<tiles:insert beanName="forteus.default" beanScope="request">  
  <tiles:put name="body-content" value="home-body.jsp"/>  
</tiles:insert>

My DEFINITION file is an XML file (forteus-tiles-defs.xml) in WEB-INF:
<!DOCTYPE tiles-definitions PUBLIC
  "-//Apache Software Foundation//DTD Tiles Configuration//EN"
  "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
<tiles-definitions>
 <definition name="forteus.default" path="/forteusLayout.jsp">    
  <put name="header" value="/common/header.jsp" />
  <put name="menubar" value="/common/menubar.jsp" />
  <put name="footer" value="/common/footer.jsp" />  
 </definition>
</tiles-definitions>

FORTEUS LAYOUT JSP
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
<html:html>
 <head>
  <title><bean:message key="global.title"/></title>
  <html:base/>
 </head>
 <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
  <tiles:insert attribute="header" />
  <tiles:insert attribute="menubar"/>  
  <tiles:insert attribute="body-content"/>
  <tiles:insert attribute="footer"/>
 </body>
</html:html>


STRUTS_CONFIG FILE:
<!-- The Tiles plugin -->
  	<plug-in className="org.apache.struts.tiles.TilesPlugin" >
  		<set-property property="definitions-config"
value="/WEB-INF/forteus-tiles-defs.xml" />
  		<set-property property="definitions-debug" value="2" />
  		<set-property property="definitions-parser-details"
value="2" />
  		<set-property property="definitions-parser-validate"
value="true" />
	</plug-in>

<!-- HOME action -->
	  	<action
		 	path="/home"
		 	type="com.rule.forteus.logon.HomeAction"
		 	scope="session"
		 	name="homeForm"
		 	validate="false"
		 	input="/home.jsp">
		 
		 	<forward name="Success" path="/home.jsp"
redirect="false"/>
		 	<forward name="Failure" path="/login.jsp"
redirect="false"/>	 
	  	</action>

> Daniel Haynes
> 
> Rule Financial
> 30 Cannon Street
> London EC4M 6YN
> T: +44 (0)20 7653 5800
> M: +44 (0)776 4200 867
> E: danielhaynes@rulefinancial.com
> 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: newbie tiles question

Posted by Cedric Dumoulin <ce...@apache.org>.
  Hi,

  As you use definitions defined in a xml file, you should insert them 
as follow:

<tiles:insert name="forteus.default" >  
  <tiles:put name="body-content" value="home-body.jsp"/>  
</tiles:insert>

  In your example, you have use "beanName" instead of "name".

    Cedric

Daniel Haynes wrote:

>I get an error when trying to display a simple JSP using Tiles:
>- org.apache.jasper.JasperException: Error - Tag Insert : No value defined
>for bean 'forteus.default' with property 'null' in scope 'request'.
> I don't fully understand what is happening, or indeed what is meant to
>happen... Does something need to be done in the action class (before
>forwarding to this JSP) to define this bean (forteus.default) or is there
>something missing in my setUp/config ?
>Any light shed on this would be appreciated ?
>Dan
>(below are the files)
>
>
>
>This is the JSP that is throwing the error: (home.jsp)
><%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
><tiles:insert beanName="forteus.default" beanScope="request">  
>  <tiles:put name="body-content" value="home-body.jsp"/>  
></tiles:insert>
>
>My DEFINITION file is an XML file (forteus-tiles-defs.xml) in WEB-INF:
><!DOCTYPE tiles-definitions PUBLIC
>  "-//Apache Software Foundation//DTD Tiles Configuration//EN"
>  "http://jakarta.apache.org/struts/dtds/tiles-config.dtd">
><tiles-definitions>
> <definition name="forteus.default" path="/forteusLayout.jsp">    
>  <put name="header" value="/common/header.jsp" />
>  <put name="menubar" value="/common/menubar.jsp" />
>  <put name="footer" value="/common/footer.jsp" />  
> </definition>
></tiles-definitions>
>
>FORTEUS LAYOUT JSP
><%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
><%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
><%@ taglib uri="/WEB-INF/tiles.tld" prefix="tiles" %>
><html:html>
> <head>
>  <title><bean:message key="global.title"/></title>
>  <html:base/>
> </head>
> <body topmargin="0" leftmargin="0" bgcolor="#FFFFFF">
>  <tiles:insert attribute="header" />
>  <tiles:insert attribute="menubar"/>  
>  <tiles:insert attribute="body-content"/>
>  <tiles:insert attribute="footer"/>
> </body>
></html:html>
>
>
>STRUTS_CONFIG FILE:
><!-- The Tiles plugin -->
>  	<plug-in className="org.apache.struts.tiles.TilesPlugin" >
>  		<set-property property="definitions-config"
>value="/WEB-INF/forteus-tiles-defs.xml" />
>  		<set-property property="definitions-debug" value="2" />
>  		<set-property property="definitions-parser-details"
>value="2" />
>  		<set-property property="definitions-parser-validate"
>value="true" />
>	</plug-in>
>
><!-- HOME action -->
>	  	<action
>		 	path="/home"
>		 	type="com.rule.forteus.logon.HomeAction"
>		 	scope="session"
>		 	name="homeForm"
>		 	validate="false"
>		 	input="/home.jsp">
>		 
>		 	<forward name="Success" path="/home.jsp"
>redirect="false"/>
>		 	<forward name="Failure" path="/login.jsp"
>redirect="false"/>	 
>	  	</action>
>
>  
>
>>Daniel Haynes
>>
>>Rule Financial
>>30 Cannon Street
>>London EC4M 6YN
>>T: +44 (0)20 7653 5800
>>M: +44 (0)776 4200 867
>>E: danielhaynes@rulefinancial.com
>>
>>    
>>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>
>  
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>