You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Geoff Callender <ge...@attglobal.net> on 2004/03/02 03:34:55 UTC
Reload page
Regarding problems caused by the "reload page" button in browsers, is either of
the following two solutions recommended, or preferred, or is there another way?
* Denis Ponomarev's solution at http://nagoya.apache.org/eyebrowse/ReadMsg?
listName=tapestry-user%20<at>%20jakarta.apache.org&msgId=1071406
* Konstantin Sharenkov's solution at http://article.gmane.org/gmane.comp.java.
tapestry.user/3580/match=contribute+action+link
"Reload page" causes unwanted behaviour in my app, so I tried to find a
solution in Virtual Library but it has the same behaviour. Here's the sequence
in Virtual Library:
1. Use the Add New Book page to add a book. You are forwarded to the
My Library page, which shows the list including your new book.
2. Press your browser's "Reload Page" book. The My Library page is
redisplayed, with the new book showing twice. It has been added again!
The browser invoked the listener of the PREVIOUS page (ie.
MyBook.addBook(IRequestCycle cycle)).
Isn't there a way to make it simply refresh the current page from the database?
Regards,
Geoff Callender
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Reload page
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
Nice.
At 02:45 PM 2/03/2004, Paul Ferraro wrote:
>Since the RedirectException constructor only accepts a URL, I subclass it
>to provide URL generation support for redirectable services (i.e.
>PageService and ExternalService):
>
>public class RedirectException extends org.apache.tapestry.RedirectException
>{
> public RedirectException(String url)
> {
> super(url);
> }
>
> public RedirectException(ILink link)
> {
> this(link.getURL());
> }
>
> public RedirectException(IRequestCycle requestCycle, String page)
> {
>
>this(requestCycle.getEngine().getService(Tapestry.PAGE_SERVICE).getLink(requestCycle,
>requestCycle.getPage(), new String[] { page }));
> }
>
> public RedirectException(IRequestCycle requestCycle, String page,
> Object parameters)
> {
>
>this(requestCycle.getEngine().getService(Tapestry.EXTERNAL_SERVICE).getLink(requestCycle,
>requestCycle.getPage(), getServiceParameters(page, parameters)));
> }
>
> private static Object[] getServiceParameters(String targetPage, Object
> parameter)
> {
> Object[] pageParameters =
> DirectLink.constructServiceParameters(parameter);
>
> if (pageParameters == null)
> {
> return new Object[] { targetPage };
> }
>
> Object[] parameters = new Object[pageParameters.length + 1];
>
> parameters[0] = targetPage;
>
> System.arraycopy(pageParameters, 0, parameters, 1,
> pageParameters.length);
>
> return parameters;
> }
>}
>
>Paul Ferraro
>
>Glen Stampoultzis wrote:
>
>>
>>This is an annoyance for me too. The solution you gave works but has
>>some limitations.
>>
>>If I need to pass information to the page I want to redirect to I
>>effectively have to make it implement IExternalPage and pass that
>>information explicitly. While this is not terrible it's not as nice as
>>being able to say:
>>
>>MyPage page = (MyPage)cycle.getPage("MyPage");
>>page.setValue1(...);
>>page.setValue2(...);
>>cycle.activate(page);
>>
>>-- Glen
>>
>>At 01:51 PM 2/03/2004, you wrote:
>>
>>>After you do your work in a listener, you could throw a redirect
>>>exception. Reload then would not re-execute the listener. I haven't
>>>looked at the solutions you mention, I'm just replying quickly with one option.
>>>
>>> Erik
>>>
>>>
>>>On Mar 1, 2004, at 9:34 PM, Geoff Callender wrote:
>>>
>>>>Regarding problems caused by the "reload page" button in browsers, is
>>>>either of
>>>>the following two solutions recommended, or preferred, or is there
>>>>another way?
>>>>
>>>> * Denis Ponomarev's solution at
>>>> http://nagoya.apache.org/eyebrowse/ReadMsg?
>>>>listName=tapestry-user%20<at>%20jakarta.apache.org&msgId=1071406
>>>> * Konstantin Sharenkov's solution at
>>>> http://article.gmane.org/gmane.comp.java.
>>>>tapestry.user/3580/match=contribute+action+link
>>>>
>>>>"Reload page" causes unwanted behaviour in my app, so I tried to find a
>>>>solution in Virtual Library but it has the same behaviour. Here's the
>>>>sequence
>>>>in Virtual Library:
>>>>
>>>>1. Use the Add New Book page to add a book. You are forwarded to the
>>>>My Library page, which shows the list including your new book.
>>>>
>>>>2. Press your browser's "Reload Page" book. The My Library page is
>>>>redisplayed, with the new book showing twice. It has been added again!
>>>>
>>>>The browser invoked the listener of the PREVIOUS page (ie.
>>>>MyBook.addBook(IRequestCycle cycle)).
>>>>
>>>>Isn't there a way to make it simply refresh the current page from the
>>>>database?
>>>>
>>>>Regards,
>>>>Geoff Callender
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>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
>>
>>
>>Glen Stampoultzis
>>gstamp@iinet.net.au
>>http://members.iinet.net.au/~gstamp/glen/
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
Re: Reload page
Posted by Paul Ferraro <pm...@columbia.edu>.
Since the RedirectException constructor only accepts a URL, I subclass
it to provide URL generation support for redirectable services (i.e.
PageService and ExternalService):
public class RedirectException extends org.apache.tapestry.RedirectException
{
public RedirectException(String url)
{
super(url);
}
public RedirectException(ILink link)
{
this(link.getURL());
}
public RedirectException(IRequestCycle requestCycle, String page)
{
this(requestCycle.getEngine().getService(Tapestry.PAGE_SERVICE).getLink(requestCycle,
requestCycle.getPage(), new String[] { page }));
}
public RedirectException(IRequestCycle requestCycle, String page,
Object parameters)
{
this(requestCycle.getEngine().getService(Tapestry.EXTERNAL_SERVICE).getLink(requestCycle,
requestCycle.getPage(), getServiceParameters(page, parameters)));
}
private static Object[] getServiceParameters(String targetPage,
Object parameter)
{
Object[] pageParameters =
DirectLink.constructServiceParameters(parameter);
if (pageParameters == null)
{
return new Object[] { targetPage };
}
Object[] parameters = new Object[pageParameters.length + 1];
parameters[0] = targetPage;
System.arraycopy(pageParameters, 0, parameters, 1,
pageParameters.length);
return parameters;
}
}
Paul Ferraro
Glen Stampoultzis wrote:
>
> This is an annoyance for me too. The solution you gave works but has
> some limitations.
>
> If I need to pass information to the page I want to redirect to I
> effectively have to make it implement IExternalPage and pass that
> information explicitly. While this is not terrible it's not as nice
> as being able to say:
>
> MyPage page = (MyPage)cycle.getPage("MyPage");
> page.setValue1(...);
> page.setValue2(...);
> cycle.activate(page);
>
> -- Glen
>
> At 01:51 PM 2/03/2004, you wrote:
>
>> After you do your work in a listener, you could throw a redirect
>> exception. Reload then would not re-execute the listener. I haven't
>> looked at the solutions you mention, I'm just replying quickly with
>> one option.
>>
>> Erik
>>
>>
>> On Mar 1, 2004, at 9:34 PM, Geoff Callender wrote:
>>
>>> Regarding problems caused by the "reload page" button in browsers,
>>> is either of
>>> the following two solutions recommended, or preferred, or is there
>>> another way?
>>>
>>> * Denis Ponomarev's solution at
>>> http://nagoya.apache.org/eyebrowse/ReadMsg?
>>> listName=tapestry-user%20<at>%20jakarta.apache.org&msgId=1071406
>>> * Konstantin Sharenkov's solution at
>>> http://article.gmane.org/gmane.comp.java.
>>> tapestry.user/3580/match=contribute+action+link
>>>
>>> "Reload page" causes unwanted behaviour in my app, so I tried to find a
>>> solution in Virtual Library but it has the same behaviour. Here's
>>> the sequence
>>> in Virtual Library:
>>>
>>> 1. Use the Add New Book page to add a book. You are forwarded to the
>>> My Library page, which shows the list including your new book.
>>>
>>> 2. Press your browser's "Reload Page" book. The My Library page is
>>> redisplayed, with the new book showing twice. It has been added again!
>>>
>>> The browser invoked the listener of the PREVIOUS page (ie.
>>> MyBook.addBook(IRequestCycle cycle)).
>>>
>>> Isn't there a way to make it simply refresh the current page from
>>> the database?
>>>
>>> Regards,
>>> Geoff Callender
>>>
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>
>
> Glen Stampoultzis
> gstamp@iinet.net.au
> http://members.iinet.net.au/~gstamp/glen/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
Re: Reload page
Posted by Glen Stampoultzis <gs...@iinet.net.au>.
This is an annoyance for me too. The solution you gave works but has some
limitations.
If I need to pass information to the page I want to redirect to I
effectively have to make it implement IExternalPage and pass that
information explicitly. While this is not terrible it's not as nice as
being able to say:
MyPage page = (MyPage)cycle.getPage("MyPage");
page.setValue1(...);
page.setValue2(...);
cycle.activate(page);
-- Glen
At 01:51 PM 2/03/2004, you wrote:
>After you do your work in a listener, you could throw a redirect
>exception. Reload then would not re-execute the listener. I haven't
>looked at the solutions you mention, I'm just replying quickly with one option.
>
> Erik
>
>
>On Mar 1, 2004, at 9:34 PM, Geoff Callender wrote:
>
>>Regarding problems caused by the "reload page" button in browsers, is
>>either of
>>the following two solutions recommended, or preferred, or is there
>>another way?
>>
>> * Denis Ponomarev's solution at
>> http://nagoya.apache.org/eyebrowse/ReadMsg?
>>listName=tapestry-user%20<at>%20jakarta.apache.org&msgId=1071406
>> * Konstantin Sharenkov's solution at
>> http://article.gmane.org/gmane.comp.java.
>>tapestry.user/3580/match=contribute+action+link
>>
>>"Reload page" causes unwanted behaviour in my app, so I tried to find a
>>solution in Virtual Library but it has the same behaviour. Here's the
>>sequence
>>in Virtual Library:
>>
>>1. Use the Add New Book page to add a book. You are forwarded to the
>>My Library page, which shows the list including your new book.
>>
>>2. Press your browser's "Reload Page" book. The My Library page is
>>redisplayed, with the new book showing twice. It has been added again!
>>
>>The browser invoked the listener of the PREVIOUS page (ie.
>>MyBook.addBook(IRequestCycle cycle)).
>>
>>Isn't there a way to make it simply refresh the current page from the
>>database?
>>
>>Regards,
>>Geoff Callender
>>
>>
>>
>>
>>
>>---------------------------------------------------------------------
>>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
>
Glen Stampoultzis
gstamp@iinet.net.au
http://members.iinet.net.au/~gstamp/glen/
Re: Reload page
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
After you do your work in a listener, you could throw a redirect
exception. Reload then would not re-execute the listener. I haven't
looked at the solutions you mention, I'm just replying quickly with one
option.
Erik
On Mar 1, 2004, at 9:34 PM, Geoff Callender wrote:
> Regarding problems caused by the "reload page" button in browsers, is
> either of
> the following two solutions recommended, or preferred, or is there
> another way?
>
> * Denis Ponomarev's solution at
> http://nagoya.apache.org/eyebrowse/ReadMsg?
> listName=tapestry-user%20<at>%20jakarta.apache.org&msgId=1071406
> * Konstantin Sharenkov's solution at
> http://article.gmane.org/gmane.comp.java.
> tapestry.user/3580/match=contribute+action+link
>
> "Reload page" causes unwanted behaviour in my app, so I tried to find a
> solution in Virtual Library but it has the same behaviour. Here's the
> sequence
> in Virtual Library:
>
> 1. Use the Add New Book page to add a book. You are forwarded to the
> My Library page, which shows the list including your new book.
>
> 2. Press your browser's "Reload Page" book. The My Library page is
> redisplayed, with the new book showing twice. It has been added again!
>
> The browser invoked the listener of the PREVIOUS page (ie.
> MyBook.addBook(IRequestCycle cycle)).
>
> Isn't there a way to make it simply refresh the current page from the
> database?
>
> Regards,
> Geoff Callender
>
>
>
>
>
> ---------------------------------------------------------------------
> 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