You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Leif Stainsby <ls...@galdosinc.com> on 2004/03/04 18:29:53 UTC

RE: Conditional being contrary -- resolved

Well, it seems the new prevPageLink value was being computed _after_ it had
been pulled during the render process.  Due to the fact that all of the work
was being done within the @Foreach, where it gets its source property, on
the resultPageList call.  It's too late at that point. ;-)

The component now does its initialization in the prepareForRender() method
which seems like the proper place for this; let me know if there's a better
place.  It is working fine now.

Tapestry is a very dynamic environnment and, for a newbie such as myself, it
isn't always immediately obvious how the various components are interacting.
But it sure is a pleasure to work with, even if I do struggle a bit now and
then.

Thanks...

...Leif

> -----Original Message-----
> From: Leif Stainsby [mailto:lstainsby@galdosinc.com]
> Sent: Wednesday, March 03, 2004 4:34 PM
> To: Tapestry users
> Subject: Conditional being contrary
>
>
> Hi,
>
> I have a result page selector component (kinda like Google's) that uses
> DirectLink to provide easy access to multiple pages of results.
>
> It also has 'Previous' and 'Next' links which are rendered conditionally
> based on the currently selected page. For example, if you're on page 1,
> there's no previous page etc.
>
> However, the conditional used for the previous link seems to be
> mis-behaving...
> I've checked the code and debug trace and it seems as though the first
> conditional does the opposite of what it should.  In other words, when
> prevPageLink==true, it does NOT get rendered.  The conditional
> for 'Next' is
> working as expected though, and since they are implemented in the same
> manner...  I'm confused.
>
> Has anyone encountered any similar problems with Conditional
> components?  Or
> am I simply missing something?  I've included a template file
> fragment with
> the conditionals below.  I'm using Beta 4 as well.
>
> Regards,
>
> ...Leif
>
>
> This a snippet of the template with the conditional components:
> --------------------------------------------------------------
>   <span jwcid="@Conditional" condition="ognl:prevPageLink">
>       <a jwcid="@DirectLink" listener="ognl:linkListener"
>           parameters="ognl:prevPosition">PREVIOUS</a>
>   </span>
>   <span jwcid="@Foreach" source="ognl:resultPageList"
> value="ognl:resultPage">
>      <a jwcid="@DirectLink"
>           listener="ognl:linkListener"
>           disabled="ognl:resultPage.disabled"
>           parameters="ognl:resultPage.startPosition">
>         <span jwcid="@Insert" value="ognl:resultPage.pageNum"/>
>      </a>
>   </span>
>   <span jwcid="@Conditional" condition="ognl:nextPageLink">
>       <a jwcid="@DirectLink" listener="ognl:linkListener"
>           parameters="ognl:nextPosition">NEXT</a>
>   </span>
> --------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> 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: Table and session problem

Posted by Jonny Wray <jo...@yahoo.com>.
Thanks for the reply.

I'm using PageLink to return to the page. It looks like I need to
implement a stateful PageLink.

I tryed your second suggestion earlier this afternoon. When I throw a
StaleSessionException myself I do not get forwarded to
StaleSession.page, but Exception.page instead.

--- Erik Hatcher <er...@ehatchersolutions.com> wrote:
> How are you returning to the page?
> 
> You can specify that DirectLink/ActionLink's are stateful, which
> should 
> take care of this situation for you if it is a hyperlink coming to
> the 
> offending page.
> 
> Also, you can also call IEngine.isStateful() and throw 
> StaleLinkException yourself if you like.
> 
> I haven't tried what I've said here, but seems that these should do
> the 
> trick.
> 
> 	Erik
> 
> On Mar 5, 2004, at 6:44 PM, Jonny Wray wrote:
> >
> > Thanks, I see the difference between engine.getVisit() and
> getVisit()
> > now. But, this still does not solve my problem, I just get a null
> visit
> > object rather than an empty one.
> >
> > Basically, if I return to a page after the session has timed out
> > shouldn't the EngineService detect this, throw a
> StaleSessionException
> > and the framework be forwarded to StaleSession.page? This is what I
> > want to happen, but on this page that uses the visit object I get
> > either a new, empty visit object (if I call getVisit) or a null
> visit
> > object (if I call engine.getVisit()).
> >
> > Any ideas what I'm missing here, or how to fix this?
> >
> > thanks,
> > Jonny
> >
> >
> > --- Marius Siegas <ma...@elinara.ktu.lt> wrote:
> >> engine.getVisit() returns null if session is timed out. I don't
> know
> >> where are you checking for time-out, but you should use
> >> getEngine().getVisit() instead of just getVisit(). Hope that
> helps...
> >>
> >> Jonny Wray wrote:
> >>> Hi,
> >>>
> >>> I'm having a problem with the contrib:Table component and
> sessions.
> >> My
> >>> source for the table is this:
> >>>
> >>> public Collection getDataSource(){
> >>>     return ((Visit)getVisit()).getResultList();
> >>> }
> >>>
> >>> The visit object result list is populated in another page. All
> >> works
> >>> fine except when I return to the page after a session time out. I
> >> don't
> >>> get forwarded to the session time out page (which is what I want)
> >> but
> >>> instead get an empty table displayed (I guess because a new visit
> >>> object is being created in the new session, and the result list
> is
> >> of
> >>> course empty).
> >>>
> >>> Anyone any ideas how to get round this,
> >>>
> >>> thanks in advance,
> >>> Jonny
> >>>
> >>>
> >>>
> >>
> ---------------------------------------------------------------------
> >>> 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
> 


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


Re: Table and session problem

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
How are you returning to the page?

You can specify that DirectLink/ActionLink's are stateful, which should 
take care of this situation for you if it is a hyperlink coming to the 
offending page.

Also, you can also call IEngine.isStateful() and throw 
StaleLinkException yourself if you like.

I haven't tried what I've said here, but seems that these should do the 
trick.

	Erik

On Mar 5, 2004, at 6:44 PM, Jonny Wray wrote:
>
> Thanks, I see the difference between engine.getVisit() and getVisit()
> now. But, this still does not solve my problem, I just get a null visit
> object rather than an empty one.
>
> Basically, if I return to a page after the session has timed out
> shouldn't the EngineService detect this, throw a StaleSessionException
> and the framework be forwarded to StaleSession.page? This is what I
> want to happen, but on this page that uses the visit object I get
> either a new, empty visit object (if I call getVisit) or a null visit
> object (if I call engine.getVisit()).
>
> Any ideas what I'm missing here, or how to fix this?
>
> thanks,
> Jonny
>
>
> --- Marius Siegas <ma...@elinara.ktu.lt> wrote:
>> engine.getVisit() returns null if session is timed out. I don't know
>> where are you checking for time-out, but you should use
>> getEngine().getVisit() instead of just getVisit(). Hope that helps...
>>
>> Jonny Wray wrote:
>>> Hi,
>>>
>>> I'm having a problem with the contrib:Table component and sessions.
>> My
>>> source for the table is this:
>>>
>>> public Collection getDataSource(){
>>>     return ((Visit)getVisit()).getResultList();
>>> }
>>>
>>> The visit object result list is populated in another page. All
>> works
>>> fine except when I return to the page after a session time out. I
>> don't
>>> get forwarded to the session time out page (which is what I want)
>> but
>>> instead get an empty table displayed (I guess because a new visit
>>> object is being created in the new session, and the result list is
>> of
>>> course empty).
>>>
>>> Anyone any ideas how to get round this,
>>>
>>> thanks in advance,
>>> Jonny
>>>
>>>
>>>
>> ---------------------------------------------------------------------
>>> 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: Table and session problem

Posted by Jonny Wray <jo...@yahoo.com>.
Thanks, I see the difference between engine.getVisit() and getVisit()
now. But, this still does not solve my problem, I just get a null visit
object rather than an empty one.

Basically, if I return to a page after the session has timed out
shouldn't the EngineService detect this, throw a StaleSessionException
and the framework be forwarded to StaleSession.page? This is what I
want to happen, but on this page that uses the visit object I get
either a new, empty visit object (if I call getVisit) or a null visit
object (if I call engine.getVisit()).

Any ideas what I'm missing here, or how to fix this?

thanks,
Jonny


--- Marius Siegas <ma...@elinara.ktu.lt> wrote:
> engine.getVisit() returns null if session is timed out. I don't know 
> where are you checking for time-out, but you should use 
> getEngine().getVisit() instead of just getVisit(). Hope that helps...
> 
> Jonny Wray wrote:
> > Hi,
> > 
> > I'm having a problem with the contrib:Table component and sessions.
> My
> > source for the table is this:
> > 
> > public Collection getDataSource(){
> >     return ((Visit)getVisit()).getResultList();
> > }
> > 
> > The visit object result list is populated in another page. All
> works
> > fine except when I return to the page after a session time out. I
> don't
> > get forwarded to the session time out page (which is what I want)
> but
> > instead get an empty table displayed (I guess because a new visit
> > object is being created in the new session, and the result list is
> of
> > course empty).
> > 
> > Anyone any ideas how to get round this,
> > 
> > thanks in advance,
> > Jonny
> > 
> > 
> >
> ---------------------------------------------------------------------
> > 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: Table and session problem

Posted by Marius Siegas <ma...@elinara.ktu.lt>.
engine.getVisit() returns null if session is timed out. I don't know 
where are you checking for time-out, but you should use 
getEngine().getVisit() instead of just getVisit(). Hope that helps...

Jonny Wray wrote:
> Hi,
> 
> I'm having a problem with the contrib:Table component and sessions. My
> source for the table is this:
> 
> public Collection getDataSource(){
>     return ((Visit)getVisit()).getResultList();
> }
> 
> The visit object result list is populated in another page. All works
> fine except when I return to the page after a session time out. I don't
> get forwarded to the session time out page (which is what I want) but
> instead get an empty table displayed (I guess because a new visit
> object is being created in the new session, and the result list is of
> course empty).
> 
> Anyone any ideas how to get round this,
> 
> thanks in advance,
> Jonny
> 
> 
> ---------------------------------------------------------------------
> 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


Table and session problem

Posted by Jonny Wray <jo...@yahoo.com>.
Hi,

I'm having a problem with the contrib:Table component and sessions. My
source for the table is this:

public Collection getDataSource(){
    return ((Visit)getVisit()).getResultList();
}

The visit object result list is populated in another page. All works
fine except when I return to the page after a session time out. I don't
get forwarded to the session time out page (which is what I want) but
instead get an empty table displayed (I guess because a new visit
object is being created in the new session, and the result list is of
course empty).

Anyone any ideas how to get round this,

thanks in advance,
Jonny


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