0

I am developing a website about artists and I would like to have clean URLs like this:

http://www.example.com/artist/artistName

where artistName is the value entered in CMS. Currently I have URLs with this structure:

http://www.example.com/artist?0&name=artistName

This is what I did:

Added mount(new MountedMapper("/artist", ArtistPage.class)); to web app's init() method and added BookmarkablePageLink:

BookmarkablePageLink link = new BookmarkablePageLink("link", ArtistPage.class, params);

How to make nice and clean URLs like in example at the very top of my post?

justasd
  • 401
  • 1
  • 12
  • 26

2 Answers2

1

The ?0 part ist the wicket page version number. It's used internally by wicket and not easily removed if your pages are statefull.

You can clean up the rest of the url by using something similar to

mountPage("/artist/${artistName}", ArtistPage.class);

This encodes the parameter artistName into the url.

Nicktar
  • 5,548
  • 1
  • 28
  • 43
0

Wicket uses an id to identify the requested page and history of requested pages including page and model versions.

If your page is stateful it is not a good idea to switch off that version system, probably you broke anything. See the question delete version number in url .

If your page is stateless you can override the stateless hint of your page to notify wicket and the id is not included into the URL (also page is not redirected). See the example on stateful and stateless pages http://www.wicket-library.com/wicket-examples-6.0.x/stateless/ .

Community
  • 1
  • 1
Martin Strejc
  • 4,307
  • 2
  • 23
  • 38