You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by René Bernhardsgrütter <re...@cerder.com> on 2012/05/12 01:12:46 UTC
How to add an URL-anchor to a redirect?
Hi T5 Users,
is it somehow possible to add an anchor-tag (example.com/#entry123) to a
page redirect? I should control this inside the POJO, not in the
template (there it's no problem).
The only way I found was by injecting the Link interface
(org.apache.tapestry5.Link) but then I can't use the strong typed Java
classes and I have to construct the URL manually.
I have this scenario: A user adds something to a form, if everything is
ok he will be redirected to the display-page (for example by returning
the injected page by the onActionMethod) where he can see what he has
posted. Then he should of course automatically jump to his post => anchor...
Is there a solution?
Regards,
René
(Sorry if there are some spelling mistakes, I don't speak English natively.)
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to add an URL-anchor to a redirect?
Posted by René Bernhardsgrütter <re...@cerder.com>.
Hi Thaigo,
thanks for you answer!
> Use PageRenderLinkSource to create a Link to the page you want, add
> the query parameters, then return it in your event handler method.
That's it. I didn't know PageRenderLinkSource, so I couldn't create the
link that easily.
For other users:
@Inject
private PageRenderLinkSource linkSource;
private Object onActionFromAnchorLink() {
long parameter = 123;
Link link =
linkSource.createPageRenderLinkWithContext(ExamplePageIndex.class,
parameter);
link.setAnchor("entry123");
return link;
}
Have a nice day!
Regards,
René
On 05/12/2012 02:38 AM, Thiago H. de Paula Figueiredo wrote:
> On Fri, 11 May 2012 20:12:46 -0300, René Bernhardsgrütter
> <re...@cerder.com> wrote:
>
>> Hi T5 Users,
>
> Hi!
>
>> is it somehow possible to add an anchor-tag (example.com/#entry123)
>> to a page redirect? I should control this inside the POJO, not in the
>> template (there it's no problem).
>
> Use PageRenderLinkSource to create a Link to the page you want, add
> the query parameters, then return it in your event handler method.
>
>> The only way I found was by injecting the Link interface
>> (org.apache.tapestry5.Link) but then I can't use the strong typed
>> Java classes
>
> Why not?
>
>> and I have to construct the URL manually.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: How to add an URL-anchor to a redirect?
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 11 May 2012 20:12:46 -0300, René Bernhardsgrütter
<re...@cerder.com> wrote:
> Hi T5 Users,
Hi!
> is it somehow possible to add an anchor-tag (example.com/#entry123) to a
> page redirect? I should control this inside the POJO, not in the
> template (there it's no problem).
Use PageRenderLinkSource to create a Link to the page you want, add the
query parameters, then return it in your event handler method.
> The only way I found was by injecting the Link interface
> (org.apache.tapestry5.Link) but then I can't use the strong typed Java
> classes
Why not?
> and I have to construct the URL manually.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org