You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Paolo <ir...@gmail.com> on 2012/03/26 04:07:36 UTC

BookmarkablePageLink with Label is supported by Wicket?

I read on this web site:

http://ondra.zizka.cz/stranky/programovani/java/web/wicket/wicket-link-with-label.texy

-----------------
Wicket does not have exactly a „link with label“ component out of the box.
Remember Wicket tries to hide the HTTP from you (and is quite good at it).
It has a Link, which can react to onClick(), and can contain anything (a simple <span> or a whole <div> with everything inside).

But some people, me included, would like to have a simple link with text, to get:

<a href="...">Text</a>

-------------------------
So my question:
Is it right?
Wicket really does not have "link with label" component out of the box?
And in wicket 1.5 or 1.6?

Is the normal solution to use onClick() override Label component?
Like this code?

	add(new Label("linktext", "Click the "+text) {
	@Override
	public void onClick() {
			PageParameters outparams = new PageParameters(); outparams.add("param", parameter);
			setResponsePage(Index.class, outparams);	
	}  

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: BookmarkablePageLink with Label is supported by Wicket?

Posted by Dan Retzlaff <dr...@gmail.com>.
Check out AbstractLink#setBody(IModel<String>).

On Sun, Mar 25, 2012 at 7:07 PM, Paolo <ir...@gmail.com> wrote:

> I read on this web site:
>
>
> http://ondra.zizka.cz/stranky/programovani/java/web/wicket/wicket-link-with-label.texy
>
> -----------------
> Wicket does not have exactly a „link with label“ component out of the box.
> Remember Wicket tries to hide the HTTP from you (and is quite good at it).
> It has a Link, which can react to onClick(), and can contain anything (a
> simple <span> or a whole <div> with everything inside).
>
> But some people, me included, would like to have a simple link with text,
> to get:
>
> <a href="...">Text</a>
>
> -------------------------
> So my question:
> Is it right?
> Wicket really does not have "link with label" component out of the box?
> And in wicket 1.5 or 1.6?
>
> Is the normal solution to use onClick() override Label component?
> Like this code?
>
>        add(new Label("linktext", "Click the "+text) {
>        @Override
>        public void onClick() {
>                        PageParameters outparams = new PageParameters();
> outparams.add("param", parameter);
>                        setResponsePage(Index.class, outparams);
>        }
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>