You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dh...@iflexsolutions.com on 2003/12/23 05:57:39 UTC

Tiles Problem!!!

I am trying out 'Declaring definition in a configuration file'

I have added below lines in struts-config.xml

  <plug-in className="org.apache.struts.tiles.TilesPlugIn">
    <set-property property="definitions-config"
value="/WEB-INF/tiles-practice-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"/>
    <set-property property="moduleAware" value="true" />    
  </plug-in>


Below are the contents of tiles-practice-defs.xml, which I have placed
in WEB-INF folder:

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

<tiles-definitions>
	<definition name="appln.default" path="/ApplnDefaultLayout.jsp">
		<put name="header" value="Menu.jsp"/>
		<put name="menubar" value="Menu.jsp"/>
		<put name="copyright" value="copyright.jsp"/>	
	</definition>
</tiles-definitions>


Below are the contents of the TilesDefsTest.jsp page:


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


<tiles:insert beanName="appln.default" beanScope="request">
	<tiles:put name="body-content" value="/index.jsp"/>
</tiles:insert>


I get following error:

org.apache.jasper.JasperException: Error - Tag Insert : No value defined
for bean 'appln.default' with property 'null' in scope 'request'. 

I am using Tomcat 4.1.27 with Struts 1.1

Regards

Dhiraj



DISCLAIMER:
This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version.

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Tiles Problem!!!

Posted by David Friedman <hu...@ix.netcom.com>.
One correction, I typed the wrong tiles:insert statement.
I meant:

<tiles:insert attribute="header"/>
or
<tiles:getAsString name="header" /> IF you need it as a simple string and
not a page include.

Regards,
David

-----Original Message-----
From: David Friedman [mailto:humble@ix.netcom.com]
Sent: Tuesday, December 23, 2003 12:19 AM
To: Struts Users Mailing List
Subject: RE: Tiles Problem!!!


Dhiraj,

I think you have an incorrect understanding of tiles.  Using your
information, you should probably setup a main template with your 3 pieces
(header, menubar, and copyright) PLUS the "body-content" one.  That way, you
can make a tile that extends that template and simply overrides the
body-content portion.  Like this example tiles template layout:

<!-- default template/layout -->
<!-- note: the page you list as body-content doesn't need to be a jsp
   but can be an html file or a text file -->
<definition name="appln.default" path="/ApplnDefaultLayout.jsp">
	<put name="header" value="Menu.jsp"/>
	<put name="menubar" value="Menu.jsp"/>
	<put name="copyright" value="copyright.jsp"/>
	<put name="body-content" value=""/>
</definition>

<!-- A page for an action uses the appln.default definition/layout/template
	It overrides the appln.default field "body-content" and forces
	it to display "/index.jsp" instead of whatever was specified
	in the appln.default definition/layout/template-->

<definition name="appln.tilesTest" extends "appln.default">
	<put name="body-content" value="/index.jsp"/>
</definition>

<!-- Another page layout using the appln.default
	template and overriding "body-content" to show another page-->

<definition name="appln.tilesSecondTest" extends "appln.default">
	<put name="body-content" value="/somepage.jsp"/>
</definition>


Then, your /ApplnDefaultLayout.jsp might be (simple layout example):

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<!-- add any html and put the tiles:insert statements wherever you choose
   This simply lists them in order -->
<tiles:insert name="header"/>
<tiles:insert name="menubar"/>
<tiles:insert name="body-content"/>
<tiles:insert name="copyright"/>


In your action, set the path of your forward to be a tiles definition:
"appln.tilesTest", "appln.tilesSecondTest" or even "appln.default" (instead
of specifying an html page or a JSP as the forward's path="SOMETHING"
parameter.

Now, about your tiles:insert statements.  Tiles is essentially a 4th scope
like the 3 normal ones: request, session, or application.  There is no need
to specify the tiles definition name as it is not a bean and wouldn't work
(and in your example, it doesn't.  The beanName attribute is for inserting a
bean's property (beanName and beanProperty should go together, that and the
fact you didn't create a real bean named "appln.tilestTest" explains your
jasper error message) in your template.  That way, you can populate the bean
with data of your choosing (random or specific) and it is one way of
displaying dynamic content.

I hope this explanation helped you with your tiles issues.

Regards,
David

-----Original Message-----
From: Dhiraj.Gupta@iflexsolutions.com
[mailto:Dhiraj.Gupta@iflexsolutions.com]
Sent: Monday, December 22, 2003 11:58 PM
To: struts-user@jakarta.apache.org
Subject: Tiles Problem!!!


I am trying out 'Declaring definition in a configuration file'

I have added below lines in struts-config.xml

  <plug-in className="org.apache.struts.tiles.TilesPlugIn">
    <set-property property="definitions-config"
value="/WEB-INF/tiles-practice-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"/>
    <set-property property="moduleAware" value="true" />
  </plug-in>


Below are the contents of tiles-practice-defs.xml, which I have placed
in WEB-INF folder:

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

<tiles-definitions>
	<definition name="appln.default" path="/ApplnDefaultLayout.jsp">
		<put name="header" value="Menu.jsp"/>
		<put name="menubar" value="Menu.jsp"/>
		<put name="copyright" value="copyright.jsp"/>
	</definition>
</tiles-definitions>


Below are the contents of the TilesDefsTest.jsp page:


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

<tiles:insert beanName="appln.default" beanScope="request">
	<tiles:put name="body-content" value="/index.jsp"/>
</tiles:insert>


I get following error:

org.apache.jasper.JasperException: Error - Tag Insert : No value defined
for bean 'appln.default' with property 'null' in scope 'request'.

I am using Tomcat 4.1.27 with Struts 1.1

Regards

Dhiraj



DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended recipient
you should not disseminate,distribute,store,print, copy or deliver this
message.Please notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or
contain viruses.The sender therefore does not accept liability for any
errors or omissions in the contents of this message which arise as a result
of e-mail transmission. If verification is required please request a
hard-copy version.

---------------------------------------------------------------------
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


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: Tiles Problem!!!

Posted by David Friedman <hu...@ix.netcom.com>.
Dhiraj,

I think you have an incorrect understanding of tiles.  Using your
information, you should probably setup a main template with your 3 pieces
(header, menubar, and copyright) PLUS the "body-content" one.  That way, you
can make a tile that extends that template and simply overrides the
body-content portion.  Like this example tiles template layout:

<!-- default template/layout -->
<!-- note: the page you list as body-content doesn't need to be a jsp
   but can be an html file or a text file -->
<definition name="appln.default" path="/ApplnDefaultLayout.jsp">
	<put name="header" value="Menu.jsp"/>
	<put name="menubar" value="Menu.jsp"/>
	<put name="copyright" value="copyright.jsp"/>
	<put name="body-content" value=""/>
</definition>

<!-- A page for an action uses the appln.default definition/layout/template
	It overrides the appln.default field "body-content" and forces
	it to display "/index.jsp" instead of whatever was specified
	in the appln.default definition/layout/template-->

<definition name="appln.tilesTest" extends "appln.default">
	<put name="body-content" value="/index.jsp"/>
</definition>

<!-- Another page layout using the appln.default
	template and overriding "body-content" to show another page-->

<definition name="appln.tilesSecondTest" extends "appln.default">
	<put name="body-content" value="/somepage.jsp"/>
</definition>


Then, your /ApplnDefaultLayout.jsp might be (simple layout example):

<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<!-- add any html and put the tiles:insert statements wherever you choose
   This simply lists them in order -->
<tiles:insert name="header"/>
<tiles:insert name="menubar"/>
<tiles:insert name="body-content"/>
<tiles:insert name="copyright"/>


In your action, set the path of your forward to be a tiles definition:
"appln.tilesTest", "appln.tilesSecondTest" or even "appln.default" (instead
of specifying an html page or a JSP as the forward's path="SOMETHING"
parameter.

Now, about your tiles:insert statements.  Tiles is essentially a 4th scope
like the 3 normal ones: request, session, or application.  There is no need
to specify the tiles definition name as it is not a bean and wouldn't work
(and in your example, it doesn't.  The beanName attribute is for inserting a
bean's property (beanName and beanProperty should go together, that and the
fact you didn't create a real bean named "appln.tilestTest" explains your
jasper error message) in your template.  That way, you can populate the bean
with data of your choosing (random or specific) and it is one way of
displaying dynamic content.

I hope this explanation helped you with your tiles issues.

Regards,
David

-----Original Message-----
From: Dhiraj.Gupta@iflexsolutions.com
[mailto:Dhiraj.Gupta@iflexsolutions.com]
Sent: Monday, December 22, 2003 11:58 PM
To: struts-user@jakarta.apache.org
Subject: Tiles Problem!!!


I am trying out 'Declaring definition in a configuration file'

I have added below lines in struts-config.xml

  <plug-in className="org.apache.struts.tiles.TilesPlugIn">
    <set-property property="definitions-config"
value="/WEB-INF/tiles-practice-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"/>
    <set-property property="moduleAware" value="true" />
  </plug-in>


Below are the contents of tiles-practice-defs.xml, which I have placed
in WEB-INF folder:

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

<tiles-definitions>
	<definition name="appln.default" path="/ApplnDefaultLayout.jsp">
		<put name="header" value="Menu.jsp"/>
		<put name="menubar" value="Menu.jsp"/>
		<put name="copyright" value="copyright.jsp"/>
	</definition>
</tiles-definitions>


Below are the contents of the TilesDefsTest.jsp page:


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

<tiles:insert beanName="appln.default" beanScope="request">
	<tiles:put name="body-content" value="/index.jsp"/>
</tiles:insert>


I get following error:

org.apache.jasper.JasperException: Error - Tag Insert : No value defined
for bean 'appln.default' with property 'null' in scope 'request'.

I am using Tomcat 4.1.27 with Struts 1.1

Regards

Dhiraj



DISCLAIMER:
This message contains privileged and confidential information and is
intended only for the individual named.If you are not the intended recipient
you should not disseminate,distribute,store,print, copy or deliver this
message.Please notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.E-mail
transmission cannot be guaranteed to be secure or error-free as information
could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or
contain viruses.The sender therefore does not accept liability for any
errors or omissions in the contents of this message which arise as a result
of e-mail transmission. If verification is required please request a
hard-copy version.

---------------------------------------------------------------------
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