Anant
Anant

Reputation: 169

Wicket request mapping

I am trying to map my requests in a special way to achieve a very simple purpose.

Say the root website is abc.com and has several users. Each user has a home page, admin page, requests page, etc.

Let us assume we have users user1 and user 2 I want the urls to be coded as:

abc.com/user1/admin

abc.com/user1/home

abc.com/user1/requests

So basically abc.com/user1/home is the home page for user 1 and abc.com/user1/admin is the the admin page for user 1.

I have tried using the request mapping in wicket using named parameters etc. I can encode my URL'S as abc.com/home/user1 but I can not get the encoding I desire. Any help is welcome.

Thanks
Anant

Upvotes: 1

Views: 492

Answers (1)

GaetanZ
GaetanZ

Reputation: 3069

I'm just starting with the version 1.5 of wicket but I think the new mapping system will resolve your point quite easily :

mountPage("{userCode}/home", UserHomePage.class);
mountPage("{userCode}/admin", UserAdminPage.class);

Then, in the page you just have to retrieve the page parameter to load your model.

String userCode = pageParameter.get("userCode").toString();

Upvotes: 1

Related Questions