Reputation: 1328
What are the ways to do a page refresh in Tapestry? I know how to refresh a zone using AjaxResponseRenderer but not quite sure about a page refresh. Any help would be much appreciated. Thanks.
Upvotes: 4
Views: 4015
Reputation: 2676
Usually your page has an onActivate() method. To refresh a page you need to have injected with @Inject the PageRenderLinkSource and then use it like in the example
@Inject
private PageRenderLinkSource pageRenderer;
Object onActivate(){}
@OnEvent(*any event*)
Object onRefresh()
{
return pageRenderer.createPageRenderLink(YourClass.class);
}
Upvotes: 2
Reputation: 88
Not sure what you are asking, but, for example, when I use the form in Tapestry and want to add "Reset" button to form, I mark the input button as:
<input t:type="submit" t:id="reset" value="${message:reset}" />
and in class, I add:
public Object onSelectedFromReset() {
return this;
}
This means that I am handling the event from reset button and I am returning this (the same would be if you return the page name return "page-name"
). When you return the page, it has the same effect if you would refreshed it.
Upvotes: 0
Reputation: 5169
There's nothing in Tapestry to refresh a page as it's just Javascript:
window.location.reload(true);
The 'true' forces the browser to reload content from the server (and not use it's cache).
Upvotes: 3