You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Rob Bugh <ro...@accuwater.com> on 2004/03/11 00:44:28 UTC

Bread Crumb Links

Is there a straight forward way to generate bread crumb links for a 
heirarchical set of pages, i.e., a sequence of links that indicate the 
ancestry of the page you are on. For instance if I navigate to a site's 
interior page the bread crumb might look like:

Home -> MyAccount -> Report ...etc.

meaning the page I'm on is nested under the Report page which is nested 
under the MyAccount page which is nested under the Home page.

Is there something built into Tapestry that would facilitate tracking the 
heirarchy of pages or do I have to write my own java code to do this?.

Rob

-- 
Rob Bugh
Accuwater, Inc.

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


Re: Bread Crumb Links

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 10, 2004, at 6:44 PM, Rob Bugh wrote:
>
> Is there a straight forward way to generate bread crumb links for a 
> heirarchical set of pages, i.e., a sequence of links that indicate the 
> ancestry of the page you are on. For instance if I navigate to a 
> site's interior page the bread crumb might look like:
>
> Home -> MyAccount -> Report ...etc.
>
> meaning the page I'm on is nested under the Report page which is 
> nested under the MyAccount page which is nested under the Home page.
>
> Is there something built into Tapestry that would facilitate tracking 
> the heirarchy of pages or do I have to write my own java code to do 
> this?.

Bread crumbs (the web definition of it) is different than what you 
describe.  Bread crumbs are tracking your path through a site, like 
http://wiki.apache.org/jakarta-tapestry does.

Tapestry doesn't really have a concept of page hierarchy at the moment. 
  This is something that it really needs for organizational and J2EE 
security purposes.  So, you will have to write your own way of creating 
that hierarchy, but Tapestry can certainly support you in displaying it 
nicely.

	Erik


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


Re: unexpected ognl null property exception

Posted by Karel Miarka <ka...@issa.cz>.
(Sorry for sending my previous message twice, I have sent it from a
different email address and supposed it will be rejected by the list
server.)

Petter> Karel's suggestion sounds like an interesting option for me to
explore,
Petter> though, since that would help keep my Visit object a bit cleaner. Is
that
Petter> the most common way to keep track of data that needs to be used
in-between
Petter> requests?

I understand it this way: If the persistent content should be accessible
from more than 1 page you must use the Visit object, but if it is intended
only for one page the persistent properties of the page are the right
choice.

Regards,
Karel

----- Original Message ----- 
From: "Petter Måhlén" <pe...@elevance.se>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Thursday, March 11, 2004 12:15 PM
Subject: RE: unexpected ognl null property exception


Well, but this sometimes led to StaleLinkExceptions when stuff was deleted,
leading to a change in the underlying data. Also, I would in general prefer
not to do "too much" initialisation for performance reasons, and in my
particular case, like in Ezra's, the data was not going to be used during
the rewind anyway. In practice, I am at the moment (still learning Tapestry
so this is likely to change) doing quite a lot of lazy initialisation in my
Page and Component classes primarily during the render phase, but trying to
keep any data that is used outside of a render (that could need to be reused
the next time the page is shown) in the Visit object.

Karel's suggestion sounds like an interesting option for me to explore,
though, since that would help keep my Visit object a bit cleaner. Is that
the most common way to keep track of data that needs to be used in-between
requests?

/ Petter

> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com]
> Sent: den 11 mars 2004 12:00
> To: Tapestry users
> Subject: Re: unexpected ognl null property exception
>
>
>
> On Mar 11, 2004, at 5:14 AM, Petter Måhlén wrote:
> > I've run into this type of problem a lot - not exactly as
> you describe
> > it,
> > though, since I didn't have a Foreach. After a lot of
> fiddling and a
> > lot of
> > reading Tapestry source code, I came to the tentative
> conclusion that
> > in my
> > case, the problem seemed to be different instances of the
> > page/component
> > class being used during render and rewind. Meaning that if I
> > initialised
> > some stuff in one page instance when the page was first rendered, I
> > couldn't
> > always count on those values still being present at the rewind.
>
> The typical way this is handled, it seems, is to do lazy
> initialization.  Check to see if a value is null (in pageBeginRender)
> and if so initialize it.
>
> Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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





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


RE: unexpected ognl null property exception

Posted by Petter Måhlén <pe...@elevance.se>.
Well, but this sometimes led to StaleLinkExceptions when stuff was deleted,
leading to a change in the underlying data. Also, I would in general prefer
not to do "too much" initialisation for performance reasons, and in my
particular case, like in Ezra's, the data was not going to be used during
the rewind anyway. In practice, I am at the moment (still learning Tapestry
so this is likely to change) doing quite a lot of lazy initialisation in my
Page and Component classes primarily during the render phase, but trying to
keep any data that is used outside of a render (that could need to be reused
the next time the page is shown) in the Visit object.

Karel's suggestion sounds like an interesting option for me to explore,
though, since that would help keep my Visit object a bit cleaner. Is that
the most common way to keep track of data that needs to be used in-between
requests?

/ Petter

> -----Original Message-----
> From: Erik Hatcher [mailto:erik@ehatchersolutions.com] 
> Sent: den 11 mars 2004 12:00
> To: Tapestry users
> Subject: Re: unexpected ognl null property exception
> 
> 
> 
> On Mar 11, 2004, at 5:14 AM, Petter Måhlén wrote:
> > I've run into this type of problem a lot - not exactly as 
> you describe 
> > it,
> > though, since I didn't have a Foreach. After a lot of 
> fiddling and a 
> > lot of
> > reading Tapestry source code, I came to the tentative 
> conclusion that 
> > in my
> > case, the problem seemed to be different instances of the 
> > page/component
> > class being used during render and rewind. Meaning that if I 
> > initialised
> > some stuff in one page instance when the page was first rendered, I 
> > couldn't
> > always count on those values still being present at the rewind.
> 
> The typical way this is handled, it seems, is to do lazy 
> initialization.  Check to see if a value is null (in pageBeginRender) 
> and if so initialize it.
> 
> 	Erik
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


Re: unexpected ognl null property exception

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Mar 11, 2004, at 5:14 AM, Petter Måhlén wrote:
> I've run into this type of problem a lot - not exactly as you describe 
> it,
> though, since I didn't have a Foreach. After a lot of fiddling and a 
> lot of
> reading Tapestry source code, I came to the tentative conclusion that 
> in my
> case, the problem seemed to be different instances of the 
> page/component
> class being used during render and rewind. Meaning that if I 
> initialised
> some stuff in one page instance when the page was first rendered, I 
> couldn't
> always count on those values still being present at the rewind.

The typical way this is handled, it seems, is to do lazy 
initialization.  Check to see if a value is null (in pageBeginRender) 
and if so initialize it.

	Erik


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


RE: unexpected ognl null property exception

Posted by Petter Måhlén <pe...@elevance.se>.
I've just implemented this, and it really represents a major improvement in
my case. So thanks for the tip, and I just have to slap myself a bit for not
seeing it sooner.

/ Petter

> -----Original Message-----
> From: Karel Miarka [mailto:karel.miarka@issa.cz] 
> Sent: den 11 mars 2004 11:57
> To: Tapestry users
> Subject: Re: unexpected ognl null property exception
> 
> 
> You don't have to place all the persistent properties (which 
> will be used
> from one request of the same user to another) into your Visit 
> class, but you
> can use persistent properties of your page class defined using page
> specification
> (http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/sta
> te.page-proper
> ties.html):
> 
> <property-specification name="xxx" type="java.lang.String" 
> persistent="yes"
> initial-value='getMessage("yyy")'/>
> 
> or manually
> (http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/sta
> te.manual-page
> -properties.html).
> 
> You cannot absolutely count on the fact that you will receive 
> the same page
> instance from the pool and you should reinitialize your page 
> classes into
> their pristine state by rewriting initialize() method.
> 
> Karel
> 
> ----- Original Message ----- 
> From: "Petter Måhlén" <pe...@elevance.se>
> To: "'Tapestry users'" <ta...@jakarta.apache.org>
> Sent: Thursday, March 11, 2004 11:14 AM
> Subject: RE: unexpected ognl null property exception
> 
> 
> I've run into this type of problem a lot - not exactly as you 
> describe it,
> though, since I didn't have a Foreach. After a lot of 
> fiddling and a lot of
> reading Tapestry source code, I came to the tentative 
> conclusion that in my
> case, the problem seemed to be different instances of the 
> page/component
> class being used during render and rewind. Meaning that if I 
> initialised
> some stuff in one page instance when the page was first 
> rendered, I couldn't
> always count on those values still being present at the 
> rewind. My solution
> was to put more stuff in the Visit object, which has solved 
> the problems.
> Could your problem be something similar?
> 
> / Petter
> 
> > -----Original Message-----
> > From: Ezra Epstein [mailto:eepstein@prajnait.com]
> > Sent: den 11 mars 2004 01:31
> > To: Tapestry users
> > Subject: unexpected ognl null property exception
> >
> >
> > First the problem, then some things I've done to try to fix
> > it and finally
> > some questions.
> >
> > 1. Problem:  I've got nicely nested components.  I take
> > advantage of this by
> > making a Browse page that has a current base component and all its
> > childComponents which are shown in a table via a Foreach:
> >
> > <html-snippet>
> > <tr jwcid="childComponents"
> > class="ognl:beans.evenOdd.next + 'Row'">
> > <td width="375"><a href="#" jwcid="@ActionLink"
> > listener="ognl:listeners.componentSelectAction"
> >   <span jwcid="@Insert" value="ognl:pubComponent.name" >Job
> > Name</span></a></td>
> > <!-- ... other table cells omitted -->
> > </tr>
> > </html-snippet>
> >
> > <page-snipped>
> > <component id="childComponents" type="Foreach">
> > <binding name="source" expression="pubComponents"/>
> > <binding name="value" expression="pubComponent"/>
> > <static-binding name="element" value="tr"/>
> > </component>
> > </page-snipped>
> >
> > When I go from component to a child component, I sometimes 
> encounter:
> >
> > <exception-snippet>
> > org.apache.tapestry.BindingException
> > Unable to resolve expression 'pubComponent.name' for
> > com.publishworks.publication.Browse$Enhance_143@82b865[publica
> > tion.Browse].
> > binding: ExpressionBinding[publication.Browse pubComponent.name]
> > location: 
> classpath:com/publishworks/publication/Browse.html, line 86
> >
> > ognl.OgnlException
> > source is null for getProperty(null, "name")
> > Stack Trace:
> > ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1435)
> > ognl.ASTProperty.getValueBody(ASTProperty.java:96)
> > ognl.SimpleNode.getValue(SimpleNode.java:192)
> > ognl.ASTChain.getValueBody(ASTChain.java:109)
> > ognl.SimpleNode.getValue(SimpleNode.java:192)
> > ognl.Ognl.getValue(Ognl.java:335)
> > ognl.Ognl.getValue(Ognl.java:310)
> > org.apache.tapestry.binding.ExpressionBinding.resolveProperty(
> > ExpressionBind
> > ing.java:242)
> > org.apache.tapestry.binding.ExpressionBinding.getObject(Expres
> > sionBinding.ja
> > va:235)
> > org.apache.tapestry.binding.AbstractBinding.getObject(Abstract
> > Binding.java:2
> > 49)
> > </exception-snippet>
> >
> > But only sometimes... that is: when a child Component has
> > fewer children
> > than its parent did... in otherwords, during the rewind, the
> > Foreach tries
> > to go past the end of the new list (or so it seems).
> >
> > 2.  Fixes: I shifted from a @DirectLink to an @ActionLink
> > assuming that this
> > would preserve the (old) value of baseComponent during rewind before
> > updating it for render --- no luck.
> >
> > 3.  Thoughts: the exception is caused by an @Insert.  This
> > partly puzzles
> > me.  In particular, since @Insert is a one-way component
> > (render only) why
> > is it called during rewind?
> >
> > Finally, I just want it all to work.  I remember seeing a
> > posting about
> > restoring old state for the rewind an then changing the state
> > before the
> > render starts, but I couldn't find the post.  Pointers please.
> >
> > == Ezra E.
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: 
> tapestry-user-help@jakarta.apache.org
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


RE: unexpected ognl null property exception

Posted by Ezra Epstein <ee...@prajnait.com>.
Thanks for the tips.  The thing is, I'm already doing all that is
recommended here.  That's what's troubling me.

So after much work back-and-forth and finally a work-around in my lazy get
method:

<code>
	/**
	 * Lazy initialization of the pubComponent from the page-persistent
(Tapestry managed) pubComponentId.
	 * @return  PublicationComponent from the current value of pubComponentId.
	 */
	public PublicationComponent getPubComponent()
	{
		Integer id = getPubComponentId();
		if (id == null)
		{
			// _pubComponent = null;
			// null is making OGNL unhappy somewhere: work-around, use empty
component instead.
			_pubComponent = PublicationComponent.EMPTY_COMPONENT;
		}
		else if (_pubComponent == null || (! id.equals(_pubComponent.getId())))
		{
			try {
				_pubComponent = PublicationComponentFinder.findById(id);
			} catch (HibernateException e) {
				throw new ApplicationRuntimeException(e);
			}
		}
		return _pubComponent;
	}
</code>

I solved my problem: bad data in the DB!!! oops, there was actually a hole
in the list!

Well, at least it wasn't Tapestry :-)

Thanks for the tips.  They helped to provide virtual pairs of much needed
extra eyes.

== Ezra Epstein

> -----Original Message-----
> From: Karel Miarka [mailto:karel.miarka@issa.cz]
>
> You don't have to place all the persistent properties (which will be used
> from one request of the same user to another) into your Visit
> class, but you
> can use persistent properties of your page class defined using page
> specification
> (http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/state.p
> age-proper
> ties.html):
>
> <property-specification name="xxx" type="java.lang.String"
> persistent="yes"
> initial-value='getMessage("yyy")'/>
>
> or manually
> (http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/state.m
> anual-page
> -properties.html).
>
> You cannot absolutely count on the fact that you will receive the
> same page
> instance from the pool and you should reinitialize your page classes into
> their pristine state by rewriting initialize() method.
>
> Karel
>


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


Re: unexpected ognl null property exception

Posted by Karel Miarka <ka...@issa.cz>.
You don't have to place all the persistent properties (which will be used
from one request of the same user to another) into your Visit class, but you
can use persistent properties of your page class defined using page
specification
(http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/state.page-proper
ties.html):

<property-specification name="xxx" type="java.lang.String" persistent="yes"
initial-value='getMessage("yyy")'/>

or manually
(http://jakarta.apache.org/tapestry/doc/TapestryUsersGuide/state.manual-page
-properties.html).

You cannot absolutely count on the fact that you will receive the same page
instance from the pool and you should reinitialize your page classes into
their pristine state by rewriting initialize() method.

Karel

----- Original Message ----- 
From: "Petter Måhlén" <pe...@elevance.se>
To: "'Tapestry users'" <ta...@jakarta.apache.org>
Sent: Thursday, March 11, 2004 11:14 AM
Subject: RE: unexpected ognl null property exception


I've run into this type of problem a lot - not exactly as you describe it,
though, since I didn't have a Foreach. After a lot of fiddling and a lot of
reading Tapestry source code, I came to the tentative conclusion that in my
case, the problem seemed to be different instances of the page/component
class being used during render and rewind. Meaning that if I initialised
some stuff in one page instance when the page was first rendered, I couldn't
always count on those values still being present at the rewind. My solution
was to put more stuff in the Visit object, which has solved the problems.
Could your problem be something similar?

/ Petter

> -----Original Message-----
> From: Ezra Epstein [mailto:eepstein@prajnait.com]
> Sent: den 11 mars 2004 01:31
> To: Tapestry users
> Subject: unexpected ognl null property exception
>
>
> First the problem, then some things I've done to try to fix
> it and finally
> some questions.
>
> 1. Problem:  I've got nicely nested components.  I take
> advantage of this by
> making a Browse page that has a current base component and all its
> childComponents which are shown in a table via a Foreach:
>
> <html-snippet>
> <tr jwcid="childComponents"
> class="ognl:beans.evenOdd.next + 'Row'">
> <td width="375"><a href="#" jwcid="@ActionLink"
> listener="ognl:listeners.componentSelectAction"
>   <span jwcid="@Insert" value="ognl:pubComponent.name" >Job
> Name</span></a></td>
> <!-- ... other table cells omitted -->
> </tr>
> </html-snippet>
>
> <page-snipped>
> <component id="childComponents" type="Foreach">
> <binding name="source" expression="pubComponents"/>
> <binding name="value" expression="pubComponent"/>
> <static-binding name="element" value="tr"/>
> </component>
> </page-snipped>
>
> When I go from component to a child component, I sometimes encounter:
>
> <exception-snippet>
> org.apache.tapestry.BindingException
> Unable to resolve expression 'pubComponent.name' for
> com.publishworks.publication.Browse$Enhance_143@82b865[publica
> tion.Browse].
> binding: ExpressionBinding[publication.Browse pubComponent.name]
> location: classpath:com/publishworks/publication/Browse.html, line 86
>
> ognl.OgnlException
> source is null for getProperty(null, "name")
> Stack Trace:
> ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1435)
> ognl.ASTProperty.getValueBody(ASTProperty.java:96)
> ognl.SimpleNode.getValue(SimpleNode.java:192)
> ognl.ASTChain.getValueBody(ASTChain.java:109)
> ognl.SimpleNode.getValue(SimpleNode.java:192)
> ognl.Ognl.getValue(Ognl.java:335)
> ognl.Ognl.getValue(Ognl.java:310)
> org.apache.tapestry.binding.ExpressionBinding.resolveProperty(
> ExpressionBind
> ing.java:242)
> org.apache.tapestry.binding.ExpressionBinding.getObject(Expres
> sionBinding.ja
> va:235)
> org.apache.tapestry.binding.AbstractBinding.getObject(Abstract
> Binding.java:2
> 49)
> </exception-snippet>
>
> But only sometimes... that is: when a child Component has
> fewer children
> than its parent did... in otherwords, during the rewind, the
> Foreach tries
> to go past the end of the new list (or so it seems).
>
> 2.  Fixes: I shifted from a @DirectLink to an @ActionLink
> assuming that this
> would preserve the (old) value of baseComponent during rewind before
> updating it for render --- no luck.
>
> 3.  Thoughts: the exception is caused by an @Insert.  This
> partly puzzles
> me.  In particular, since @Insert is a one-way component
> (render only) why
> is it called during rewind?
>
> Finally, I just want it all to work.  I remember seeing a
> posting about
> restoring old state for the rewind an then changing the state
> before the
> render starts, but I couldn't find the post.  Pointers please.
>
> == Ezra E.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


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



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


RE: unexpected ognl null property exception

Posted by Petter Måhlén <pe...@elevance.se>.
I've run into this type of problem a lot - not exactly as you describe it,
though, since I didn't have a Foreach. After a lot of fiddling and a lot of
reading Tapestry source code, I came to the tentative conclusion that in my
case, the problem seemed to be different instances of the page/component
class being used during render and rewind. Meaning that if I initialised
some stuff in one page instance when the page was first rendered, I couldn't
always count on those values still being present at the rewind. My solution
was to put more stuff in the Visit object, which has solved the problems.
Could your problem be something similar?

/ Petter

> -----Original Message-----
> From: Ezra Epstein [mailto:eepstein@prajnait.com] 
> Sent: den 11 mars 2004 01:31
> To: Tapestry users
> Subject: unexpected ognl null property exception
> 
> 
> First the problem, then some things I've done to try to fix 
> it and finally
> some questions.
> 
> 1. Problem:  I've got nicely nested components.  I take 
> advantage of this by
> making a Browse page that has a current base component and all its
> childComponents which are shown in a table via a Foreach:
> 
> <html-snippet>
> 	<tr jwcid="childComponents" 
> class="ognl:beans.evenOdd.next + 'Row'">
> 	 <td width="375"><a href="#" jwcid="@ActionLink"
> listener="ognl:listeners.componentSelectAction"
> 	  <span jwcid="@Insert" value="ognl:pubComponent.name" >Job
> Name</span></a></td>
> 	<!-- ... other table cells omitted -->
> 	</tr>
> </html-snippet>
> 
> <page-snipped>
> 	<component id="childComponents" type="Foreach">
> 		<binding name="source" expression="pubComponents"/>
> 		<binding name="value" expression="pubComponent"/>
> 		<static-binding name="element" value="tr"/>
> 	</component>
> </page-snipped>
> 
> When I go from component to a child component, I sometimes encounter:
> 
> <exception-snippet>
> org.apache.tapestry.BindingException
> Unable to resolve expression 'pubComponent.name' for
> com.publishworks.publication.Browse$Enhance_143@82b865[publica
> tion.Browse].
> binding: ExpressionBinding[publication.Browse pubComponent.name]
> location: classpath:com/publishworks/publication/Browse.html, line 86
> 
> ognl.OgnlException
> source is null for getProperty(null, "name")
> Stack Trace:
> ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1435)
> ognl.ASTProperty.getValueBody(ASTProperty.java:96)
> ognl.SimpleNode.getValue(SimpleNode.java:192)
> ognl.ASTChain.getValueBody(ASTChain.java:109)
> ognl.SimpleNode.getValue(SimpleNode.java:192)
> ognl.Ognl.getValue(Ognl.java:335)
> ognl.Ognl.getValue(Ognl.java:310)
> org.apache.tapestry.binding.ExpressionBinding.resolveProperty(
> ExpressionBind
> ing.java:242)
> org.apache.tapestry.binding.ExpressionBinding.getObject(Expres
> sionBinding.ja
> va:235)
> org.apache.tapestry.binding.AbstractBinding.getObject(Abstract
> Binding.java:2
> 49)
> </exception-snippet>
> 
> But only sometimes... that is: when a child Component has 
> fewer children
> than its parent did... in otherwords, during the rewind, the 
> Foreach tries
> to go past the end of the new list (or so it seems).
> 
> 2.  Fixes: I shifted from a @DirectLink to an @ActionLink 
> assuming that this
> would preserve the (old) value of baseComponent during rewind before
> updating it for render --- no luck.
> 
> 3.  Thoughts: the exception is caused by an @Insert.  This 
> partly puzzles
> me.  In particular, since @Insert is a one-way component 
> (render only) why
> is it called during rewind?
> 
> Finally, I just want it all to work.  I remember seeing a 
> posting about
> restoring old state for the rewind an then changing the state 
> before the
> render starts, but I couldn't find the post.  Pointers please.
> 
> == Ezra E.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


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


unexpected ognl null property exception

Posted by Ezra Epstein <ee...@prajnait.com>.
First the problem, then some things I've done to try to fix it and finally
some questions.

1. Problem:  I've got nicely nested components.  I take advantage of this by
making a Browse page that has a current base component and all its
childComponents which are shown in a table via a Foreach:

<html-snippet>
	<tr jwcid="childComponents" class="ognl:beans.evenOdd.next + 'Row'">
	 <td width="375"><a href="#" jwcid="@ActionLink"
listener="ognl:listeners.componentSelectAction"
	  <span jwcid="@Insert" value="ognl:pubComponent.name" >Job
Name</span></a></td>
	<!-- ... other table cells omitted -->
	</tr>
</html-snippet>

<page-snipped>
	<component id="childComponents" type="Foreach">
		<binding name="source" expression="pubComponents"/>
		<binding name="value" expression="pubComponent"/>
		<static-binding name="element" value="tr"/>
	</component>
</page-snipped>

When I go from component to a child component, I sometimes encounter:

<exception-snippet>
org.apache.tapestry.BindingException
Unable to resolve expression 'pubComponent.name' for
com.publishworks.publication.Browse$Enhance_143@82b865[publication.Browse].
binding: ExpressionBinding[publication.Browse pubComponent.name]
location: classpath:com/publishworks/publication/Browse.html, line 86

ognl.OgnlException
source is null for getProperty(null, "name")
Stack Trace:
ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1435)
ognl.ASTProperty.getValueBody(ASTProperty.java:96)
ognl.SimpleNode.getValue(SimpleNode.java:192)
ognl.ASTChain.getValueBody(ASTChain.java:109)
ognl.SimpleNode.getValue(SimpleNode.java:192)
ognl.Ognl.getValue(Ognl.java:335)
ognl.Ognl.getValue(Ognl.java:310)
org.apache.tapestry.binding.ExpressionBinding.resolveProperty(ExpressionBind
ing.java:242)
org.apache.tapestry.binding.ExpressionBinding.getObject(ExpressionBinding.ja
va:235)
org.apache.tapestry.binding.AbstractBinding.getObject(AbstractBinding.java:2
49)
</exception-snippet>

But only sometimes... that is: when a child Component has fewer children
than its parent did... in otherwords, during the rewind, the Foreach tries
to go past the end of the new list (or so it seems).

2.  Fixes: I shifted from a @DirectLink to an @ActionLink assuming that this
would preserve the (old) value of baseComponent during rewind before
updating it for render --- no luck.

3.  Thoughts: the exception is caused by an @Insert.  This partly puzzles
me.  In particular, since @Insert is a one-way component (render only) why
is it called during rewind?

Finally, I just want it all to work.  I remember seeing a posting about
restoring old state for the rewind an then changing the state before the
render starts, but I couldn't find the post.  Pointers please.

== Ezra E.


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