Daniel <[EMAIL PROTECTED]> writes:
refresh() is called by Turbine on tools whose scope is longer than
just a single request (e.g. session tools) whenever a new request is
processed.
If you tool has just a lifecycle of a single request, there is no
point in calling refresh() so Turbine does not do it.
Regards
Henning
>Hi Richard,
>Actually, the refresh() method of the ApplicationTool interface is never
>called (only the init() method is called for each new request), so that
>would explain why your messages aren't being cleared. I think the
>intention of the refesh() method is so that your code can manually call it
>to do the appropriate thing when you need to but it's not called
>automatically. You can verify this by adding log statements.
>I think to solve your problem you'd want to also implement the Recyclable
>interface. You can take a look at how it's done with the IntakeTool
>(which is also a request pull tool).
>Regards,
>Daniel
>On Fri, 21 May 2004, Richard Han wrote:
>> You store the confirm/alert/error msg in user's session, but I store
>> them in my request tool, (see the following snippet), what I don't
>> understand is why the message not reset for a request tool (for reqest
>> tool, they should be refreshed upon each request, am I correct?)
>>
>> In my request pull tool class, I have:
>> <snippet>
>> private Object confirmMessage;
>> private Object infoMessage;
>> private Object alertMessage;
>>
>> public void refresh() {
>> confirmMessage = null;
>> infoMessage = null;
>> alertMessage = null;
>> }
>>
>> public Object getConfirmMessage() {
>> return confirmMessage;
>> }
>>
>> public void setConfirmMessage(Object v) {
>> this.confirmMessage = v;
>> }
>> ...
>> </snippet>
>>
>> Thanks!
>>
>> richard
>>
>>
>> On Fri, 2004-05-21 at 16:17, Louis Moore wrote:
>> > I can't tell from your snippet where the message is
>> > actually being stored but if it's in the temp session
>> > data then you have to reset it to empty after showing
>> > the message. Here's a snippet from my Message.vm
>> > template:
>> >
>> > #if(!$data.User.getTemp($nocwebG.Constant.ERROR_MESSAGE,"").equals(""))
>> > <div
>> > class="errormessage"><p>$nocwebR.addBreaks($!data.User.getTemp($nocwebG.Constant.ERROR_MESSAGE))</div>
>> >
>> > $data.User.setTemp($nocwebG.Constant.ERROR_MESSAGE,"")
>> > #end
>> >
>> > hope it helps,
>> > Lou
>> >
>> > --- Richard Han <[EMAIL PROTECTED]> wrote:
>> > > I tried another way to set confirm/alert/error
>> > > messages
>> > > - in my layout/default.vm, I have a macro
>> > > #actionMessage()
>> > > <td align="left" valign="top">
>> > > #actionMessage()
>> > > $screen_placeholder
>> > > </td>
>> > > - The macro #actionMessage() uses a request pull
>> > > tool to check
>> > > confirm/alert/error message set within action
>> > > #macro (actionMessage)
>> > > #if($myReqTool.ConfirmMessage)
>> > > <p
>> > >
>> > class="confirmmsg"><strong>$myReqTool.ConfirmMessage</strong></p>
>> > >
>> > > #end
>> > >
>> > > #if($myReqTool.AlertMessage)
>> > > <p
>> > > class="alertmsg"><strong>$myReqTool</strong></p>
>> > > #end
>> > > #end
>> > >
>> > > This is basically the way how turbine-3/scarab deals
>> > > with
>> > > confirm/alert/error messasges (if I am correct),
>> > >
>> > > But for reasons I don't know, the confirm/alert
>> > > message is persistent to
>> > > different pages and won't go away.
>> > > Can somebody points out what I am missing? or share
>> > > your way?
>> > >
>> > > Thanks
>> > >
>> > > richard
>> > >
>> > >
>> > >
>> > > On Fri, 2004-05-21 at 11:58, Louis Moore wrote:
>> > > > There's probably a ton of different ways to do
>> > > this,
>> > > > but I've been setting session parameters in my
>> > > java
>> > > > classes, something like:
>> > > >
>> > > > if (!inputOK)
>> > > > {
>> > > > // alert
>> > > > data.getUser().setTemp("warningmsg","Bad
>> > > input!");
>> > > > return;
>> > > > }
>> > > >
>> > > > try
>> > > > {
>> > > > // success
>> > > >
>> > > data.getUser().setTemp("successmsg","Successful");
>> > > > }
>> > > > catch
>> > > > {
>> > > > // failure
>> > > > data.getUser().setTemp("errormsg","Failed");
>> > > > }
>> > > >
>> > > > Then I have a template Message.vm which checks for
>> > > > those parameters and prints the messages if they
>> > > are
>> > > > there, then removes the parameters. This template
>> > > is
>> > > > parsed inside my Default.vm layout so it's on
>> > > every
>> > > > page. I'd also be interested in hearing how other
>> > > > people are doing this.
>> > > >
>> > > > -Lou
>> > > >
>> > > >
>> > > > --- Pradeep Kumar <[EMAIL PROTECTED]> wrote:
>> > > > > Hi Richard,
>> > > > >
>> > > > > You can use javascript for this. On vm page for
>> > > the
>> > > > > click of any button
>> > > > > you can write a java script function which can
>> > > be
>> > > > > used to set
>> > > > > comfirm/alert/error message .
>> > > > > If you have tried some otherway let us know.
>> > > > > Thanks,
>> > > > > Pradeep
>> > > > >
>> > > > > >>> [EMAIL PROTECTED] 5/21/2004 8:44:44 AM >>>
>> > > > > Hi everyone,
>> > > > >
>> > > > > In turbine-2.3, how do you set
>> > > comfirm/alert/error
>> > > > > message ?
>> > > > >
>> > > > > Thank you in advance!
>> > > > >
>> > > > > richard
>> > > > >
>> > > > >
>> > > > >
>> > > >
>> > >
>> > ---------------------------------------------------------------------
>> > > > > To unsubscribe, e-mail:
>> > > > > [EMAIL PROTECTED]
>> > > > > For additional commands, e-mail:
>> > > > > [EMAIL PROTECTED]
>> > > > >
>> > > > >
>> > > > >
>> > > >
>> > >
>> > ---------------------------------------------------------------------
>> > > > > To unsubscribe, e-mail:
>> > > > > [EMAIL PROTECTED]
>> > > > > For additional commands, e-mail:
>> > > > > [EMAIL PROTECTED]
>> > > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > >
>> > > > __________________________________
>> > > > Do you Yahoo!?
>> > > > Yahoo! Domains Claim yours for only $14.70/year
>> > > > http://smallbusiness.promotions.yahoo.com/offer
>> > > >
>> > > >
>> > >
>> > ---------------------------------------------------------------------
>> > > > To unsubscribe, e-mail:
>> > > [EMAIL PROTECTED]
>> > > > For additional commands, e-mail:
>> > > [EMAIL PROTECTED]
>> > > >
>> > >
>> > >
>> > >
>> > ---------------------------------------------------------------------
>> > > To unsubscribe, e-mail:
>> > > [EMAIL PROTECTED]
>> > > For additional commands, e-mail:
>> > > [EMAIL PROTECTED]
>> > >
>> >
>> >
>> >
>> >
>> >
>> > __________________________________
>> > Do you Yahoo!?
>> > Yahoo! Domains Claim yours for only $14.70/year
>> > http://smallbusiness.promotions.yahoo.com/offer
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: [EMAIL PROTECTED]
>> > For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen INTERMETA GmbH
[EMAIL PROTECTED] +49 9131 50 654 0 http://www.intermeta.de/
RedHat Certified Engineer -- Jakarta Turbine Development -- hero for hire
Linux, Java, perl, Solaris -- Consulting, Training, Development
"Fighting for one's political stand is an honourable action, but re-
fusing to acknowledge that there might be weaknesses in one's
position - in order to identify them so that they can be remedied -
is a large enough problem with the Open Source movement that it
deserves to be on this list of the top five problems."
-- Michelle Levesque, "Fundamental Issues with
Open Source Software Development"
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]