You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "F. Da Costa Gomez" <dc...@fixed.com> on 2003/07/08 14:58:45 UTC
Parameter setting prior to showing on Screen
Hi all,
I know this is a pretty standard thingy but I'm not seeing my error here.
Situation:
User is logged in, visit holds a ref to the user-profile
Page UserProfile should be used to mod the profile.
On rendering the UserProfile page there are some fields that should
obviously be filled in prior to being shown on the screen.
In order to do that I need to get the user ref from the visit to read
its entries and do something 'nice' with them.
Doing
public String getAddress() {
if (_address==null) _address=((CommercialUser) ((Visit)
getEngine().getVisit()).getUser()).getAddress();
return _address;
}
Works fine but is not the thing I am looking for.
I'd rather set all parameters (like _address) in 1 go and not be bother
any more.
So I tried:
protected void initialize() {
//super.initialize(); with or without does not help
_nonCorporateUser = (CommercialUser) ((Visit)
getEngine().getVisit()).getUser();
_address = _nonCorporateUser.getAddress();
...
}
Unfortunately this throws an initialization error because there is no
Engine to be gotten at this point.
I'm sure I'm overlooking something simple but 4 now its eluding me quite
'craftily'.
A pointer in the right direction would be much appreciated.
TIA,
Fermin DCG
Re: Parameter setting prior to showing on Screen
Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
You won't believe this, but the very moment I saw your reply coming in I
was doing exactly that.
Well, at least the old brain still functions. :-)
Thx 4 the reply.
Cheers
Fermin DCG
Laurent Cornelis wrote:
>You should not initialize user specific data (ie Visit data) in initialize()
>method but for example in pageBeginRender() method.
>
>
>
Re: Parameter setting prior to showing on Screen
Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
Thx, this is exactly what I was looking for.
Cheers,
Fermin
Eric Schneider wrote:
>Try to execute the same code in prepareForRender(). See if you have
>different results.
>
>Cheers,
>Eric
>
>----- Original Message -----
>From: "F. Da Costa Gomez" <dc...@fixed.com>
>To: "Tapestry users" <ta...@jakarta.apache.org>
>Sent: Tuesday, July 08, 2003 9:26 AM
>Subject: Re: Parameter setting prior to showing on Screen
>
>
>
>
>>Laurent Cornelis wrote:
>>
>>
>>
>>>You should not initialize user specific data (ie Visit data) in
>>>
>>>
>initialize()
>
>
>>>method but for example in pageBeginRender() method.
>>>
>>>
>>>
>>>
>>Tried
>> public void beginPageRender() {
>> if (_nonCorporateUser==null) {
>> _nonCorporateUser = (CommercialUser) ((Visit)
>>getEngine().getVisit()).getUser();
>> _address = _nonCorporateUser.getAddress();
>> _city = _nonCorporateUser.getCity();
>> }
>> super.beginPageRender();
>> }
>>
>>but it does not even go there.
>>Set a breakpoint on if (... but it never even reaches that point.
>>
>>So I guess this is not exactly what I am looking 4.
>>Open to new suggestions however.
>>
>>TIA & Cheers
>>Fermin DCG
>>
>>
>>---------------------------------------------------------------------
>>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: Parameter setting prior to showing on Screen
Posted by Eric Schneider <er...@centralparksoftware.com>.
Try to execute the same code in prepareForRender(). See if you have
different results.
Cheers,
Eric
----- Original Message -----
From: "F. Da Costa Gomez" <dc...@fixed.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, July 08, 2003 9:26 AM
Subject: Re: Parameter setting prior to showing on Screen
> Laurent Cornelis wrote:
>
> >You should not initialize user specific data (ie Visit data) in
initialize()
> >method but for example in pageBeginRender() method.
> >
> >
> Tried
> public void beginPageRender() {
> if (_nonCorporateUser==null) {
> _nonCorporateUser = (CommercialUser) ((Visit)
> getEngine().getVisit()).getUser();
> _address = _nonCorporateUser.getAddress();
> _city = _nonCorporateUser.getCity();
> }
> super.beginPageRender();
> }
>
> but it does not even go there.
> Set a breakpoint on if (... but it never even reaches that point.
>
> So I guess this is not exactly what I am looking 4.
> Open to new suggestions however.
>
> TIA & Cheers
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Parameter setting prior to showing on Screen
Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
prepareForRender() (as Eric suggested) did the trick.
I will keep this in mind though because even though this was basically
an initialization issue. I'm sure I'll also run into an event issue
eventually. Hmm.
Thx & cheers
Fermin
Laurent Cornelis wrote:
>Your page have to implements PageRenderListener.
>
>In the Page's constructor put :
>
>addPageRenderListener(this);
>
>and now override beginPageRender(PageEvent e);
>
>and it will works ;-)
>
>
>
>>>You should not initialize user specific data (ie Visit data) in
>>>
>>>
>initialize()
>
>
>>>method but for example in pageBeginRender() method.
>>>
>>>
>>>
>>>
>>Tried
>> public void beginPageRender() {
>> if (_nonCorporateUser==null) {
>> _nonCorporateUser = (CommercialUser) ((Visit)
>>getEngine().getVisit()).getUser();
>> _address = _nonCorporateUser.getAddress();
>> _city = _nonCorporateUser.getCity();
>> }
>> super.beginPageRender();
>> }
>>
>>but it does not even go there.
>>Set a breakpoint on if (... but it never even reaches that point.
>>
>>So I guess this is not exactly what I am looking 4.
>>Open to new suggestions however.
>>
>>TIA & Cheers
>>Fermin DCG
>>
>>
>>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
>
>
>
>
RE: Parameter setting prior to showing on Screen
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Using 3.0 and, I believe, 2.3, it is not necessary to register the page explicitly.
Inside AbstractComponent.finishLoad(), each component (including the page) automatically registers
with the page if the component implements the interface.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: Laurent Cornelis [mailto:laurent@ubiquity.be]
> Sent: Tuesday, July 08, 2003 9:25 AM
> To: Tapestry users
> Subject: Re: Parameter setting prior to showing on Screen
>
>
> Your page have to implements PageRenderListener.
>
> In the Page's constructor put :
>
> addPageRenderListener(this);
>
> and now override beginPageRender(PageEvent e);
>
> and it will works ;-)
>
> >
> > >You should not initialize user specific data (ie Visit data) in
> initialize()
> > >method but for example in pageBeginRender() method.
> > >
> > >
> > Tried
> > public void beginPageRender() {
> > if (_nonCorporateUser==null) {
> > _nonCorporateUser = (CommercialUser) ((Visit)
> > getEngine().getVisit()).getUser();
> > _address = _nonCorporateUser.getAddress();
> > _city = _nonCorporateUser.getCity();
> > }
> > super.beginPageRender();
> > }
> >
> > but it does not even go there.
> > Set a breakpoint on if (... but it never even reaches that point.
> >
> > So I guess this is not exactly what I am looking 4.
> > Open to new suggestions however.
> >
> > TIA & Cheers
> > Fermin DCG
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
Re: Parameter setting prior to showing on Screen
Posted by Laurent Cornelis <la...@ubiquity.be>.
Your page have to implements PageRenderListener.
In the Page's constructor put :
addPageRenderListener(this);
and now override beginPageRender(PageEvent e);
and it will works ;-)
>
> >You should not initialize user specific data (ie Visit data) in
initialize()
> >method but for example in pageBeginRender() method.
> >
> >
> Tried
> public void beginPageRender() {
> if (_nonCorporateUser==null) {
> _nonCorporateUser = (CommercialUser) ((Visit)
> getEngine().getVisit()).getUser();
> _address = _nonCorporateUser.getAddress();
> _city = _nonCorporateUser.getCity();
> }
> super.beginPageRender();
> }
>
> but it does not even go there.
> Set a breakpoint on if (... but it never even reaches that point.
>
> So I guess this is not exactly what I am looking 4.
> Open to new suggestions however.
>
> TIA & Cheers
> Fermin DCG
>
RE: Parameter setting prior to showing on Screen
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
You have to have the class implement the PageRenderListener interface as well as implement the
method.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: F. Da Costa Gomez [mailto:dcg@fixed.com]
> Sent: Tuesday, July 08, 2003 9:26 AM
> To: Tapestry users
> Subject: Re: Parameter setting prior to showing on Screen
>
>
> Laurent Cornelis wrote:
>
> >You should not initialize user specific data (ie Visit data) in
> >initialize() method but for example in pageBeginRender() method.
> >
> >
> Tried
> public void beginPageRender() {
> if (_nonCorporateUser==null) {
> _nonCorporateUser = (CommercialUser) ((Visit)
> getEngine().getVisit()).getUser();
> _address = _nonCorporateUser.getAddress();
> _city = _nonCorporateUser.getCity();
> }
> super.beginPageRender();
> }
>
> but it does not even go there.
> Set a breakpoint on if (... but it never even reaches that point.
>
> So I guess this is not exactly what I am looking 4.
> Open to new suggestions however.
>
> TIA & Cheers
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
Re: Parameter setting prior to showing on Screen
Posted by "F. Da Costa Gomez" <dc...@fixed.com>.
Laurent Cornelis wrote:
>You should not initialize user specific data (ie Visit data) in initialize()
>method but for example in pageBeginRender() method.
>
>
Tried
public void beginPageRender() {
if (_nonCorporateUser==null) {
_nonCorporateUser = (CommercialUser) ((Visit)
getEngine().getVisit()).getUser();
_address = _nonCorporateUser.getAddress();
_city = _nonCorporateUser.getCity();
}
super.beginPageRender();
}
but it does not even go there.
Set a breakpoint on if (... but it never even reaches that point.
So I guess this is not exactly what I am looking 4.
Open to new suggestions however.
TIA & Cheers
Fermin DCG
Re: Parameter setting prior to showing on Screen
Posted by Laurent Cornelis <la...@ubiquity.be>.
You should not initialize user specific data (ie Visit data) in initialize()
method but for example in pageBeginRender() method.
----- Original Message -----
From: "F. Da Costa Gomez" <dc...@fixed.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Tuesday, July 08, 2003 2:58 PM
Subject: Parameter setting prior to showing on Screen
> Hi all,
>
> I know this is a pretty standard thingy but I'm not seeing my error here.
> Situation:
> User is logged in, visit holds a ref to the user-profile
> Page UserProfile should be used to mod the profile.
> On rendering the UserProfile page there are some fields that should
> obviously be filled in prior to being shown on the screen.
> In order to do that I need to get the user ref from the visit to read
> its entries and do something 'nice' with them.
> Doing
> public String getAddress() {
> if (_address==null) _address=((CommercialUser) ((Visit)
> getEngine().getVisit()).getUser()).getAddress();
> return _address;
> }
> Works fine but is not the thing I am looking for.
>
> I'd rather set all parameters (like _address) in 1 go and not be bother
> any more.
> So I tried:
> protected void initialize() {
> //super.initialize(); with or without does not help
> _nonCorporateUser = (CommercialUser) ((Visit)
> getEngine().getVisit()).getUser();
> _address = _nonCorporateUser.getAddress();
> ...
> }
> Unfortunately this throws an initialization error because there is no
> Engine to be gotten at this point.
>
> I'm sure I'm overlooking something simple but 4 now its eluding me quite
> 'craftily'.
>
> A pointer in the right direction would be much appreciated.
>
> TIA,
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
RE: Parameter setting prior to showing on Screen
Posted by "Howard M. Lewis Ship" <hl...@comcast.net>.
Try using the pageBeginRender() method of the PageRenderListener interface.
--
Howard M. Lewis Ship
Creator, Tapestry: Java Web Components
http://jakarta.apache.org/tapestry
> -----Original Message-----
> From: F. Da Costa Gomez [mailto:dcg@fixed.com]
> Sent: Tuesday, July 08, 2003 8:59 AM
> To: Tapestry users
> Subject: Parameter setting prior to showing on Screen
>
>
> Hi all,
>
> I know this is a pretty standard thingy but I'm not seeing my
> error here.
> Situation:
> User is logged in, visit holds a ref to the user-profile
> Page UserProfile should be used to mod the profile.
> On rendering the UserProfile page there are some fields that should
> obviously be filled in prior to being shown on the screen.
> In order to do that I need to get the user ref from the visit to read
> its entries and do something 'nice' with them.
> Doing
> public String getAddress() {
> if (_address==null) _address=((CommercialUser) ((Visit)
> getEngine().getVisit()).getUser()).getAddress();
> return _address;
> }
> Works fine but is not the thing I am looking for.
>
> I'd rather set all parameters (like _address) in 1 go and not
> be bother
> any more.
> So I tried:
> protected void initialize() {
> //super.initialize(); with or without does not help
> _nonCorporateUser = (CommercialUser) ((Visit)
> getEngine().getVisit()).getUser();
> _address = _nonCorporateUser.getAddress();
> ...
> }
> Unfortunately this throws an initialization error because there is no
> Engine to be gotten at this point.
>
> I'm sure I'm overlooking something simple but 4 now its
> eluding me quite
> 'craftily'.
>
> A pointer in the right direction would be much appreciated.
>
> TIA,
> Fermin DCG
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>