Wicket 请求映射

发布于 2024-12-11 08:24:09 字数 506 浏览 0 评论 0原文

我正在尝试以特殊的方式映射我的请求以实现一个非常简单的目的。

假设根网站是 abc.com 并且有多个用户。每个用户都有一个主页、管理页面、请求页面等。

假设我们有用户 user1user 2 我希望网址编码为:

abc.com/user1/admin

abc.com/user1/home

abc.com/user1/requests

所以基本上 abc.com/user1/homeuser 1abc.com/user1/admin 的主页 是用户 1 的管理页面。

我尝试使用命名参数等在 wicket 中使用请求映射。我可以将我的 URL 编码为 abc.com/home/user1 但我可以没有得到编码我 欲望。 欢迎任何帮助。

谢谢
阿南特

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

走野 2024-12-18 08:24:09

我刚刚开始使用 wicket 1.5 版本,但我认为新的映射系统将很容易地解决您的问题:

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

然后,在页面中您只需检索页面参数即可加载模型。

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

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文