You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by Haim Schindler <ha...@gmail.com> on 2010/04/13 18:05:30 UTC
How to create simple anchor
*I need to dynamically create an html link that points to another page.
Is this the way to do it ?
*
@Bindable
protected ActionLink someLink;
....
.....
someLink.setActionListener(new ActionListener() {
public boolean onAction(Control source) {
String path = getContext().getPagePath(SomePage.class);
setRedirect(path);
return true;
}
});
*the problem with this is that it uses "Redirect" so two calls are issues to
the server instead of one if I just generate the html link by myself.*
Re: How to create simple anchor
Posted by Bob Schellink <sa...@gmail.com>.
Hi Haim,
On 14/04/2010 02:05, Haim Schindler wrote:
>
> *I need to dynamically create an html link that points to another page.
> Is this the way to do it ?
You can use a PageLink instead of a ActionLink to link to a Page directly.
> someLink.setActionListener(new ActionListener() {
> public boolean onAction(Control source) {
> String path = getContext().getPagePath(SomePage.class);
> setRedirect(path);
> return true;
> }
> });
>
> *the problem with this is that it uses "Redirect" so two calls are
> issues to the server instead of one if I just generate the html link by
> myself.*
You could also use a "forward" instead of a "redirect", but that leave the browser URL referring to
the previous page, which might not be what you want.
Your best bet is probably a PageLink.
kind regards
bob