如何在 Wicket 中检索查询参数
我正在使用 wicket 应用程序在代码中启动 Java 方法。我的网址如下
http://localhost:8080/web/ resources/org.apache.wicket.Application/StartMethod
我想在末尾添加一个额外的选项 client=cutomser1
http://localhost:8080/web/resources/org.apache.wicket.Application/StartMethod?client=customer1
因为我想要这些使用相同的代码,但针对不同的客户
因此,当我从命令 promte 运行此 URL 时,它应该将 Customer1 提取到我的 Java 代码中 这样.. String client = customer1
我如何在 Java 中实现这一点。我的意思是我想获取这个字符串名称 customer1
I am using wicket application to initiate my Java method in my code. I have the url as follows
http://localhost:8080/web/resources/org.apache.wicket.Application/StartMethod
I want to add an extra option at the end client=cutomser1
http://localhost:8080/web/resources/org.apache.wicket.Application/StartMethod?client=customer1
As I want these use the same code but for different customers
So when I run this URL from command promte it should fetch the Customer1 into my Java code
in this way..
String client = customer1
How can I implement this in Java. I mean I want to fetch this String name customer1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Wicket 在数据绑定方面很强大,您应该利用这一点。
如果您在浏览器中显示来自 Customer1 的数据,Wicket 就会知道您何时从该页面发出请求。
请求参数到变量的转换发生在幕后。
乍一看这令人不安,但按预期使用时却非常强大。
我建议您从 答案中选择一个好的教程这个问题并通过几个例子来了解事情是如何完成的。这可能需要一个下午的时间,但在一周结束之前就会得到回报。
Wicket is strong in data binding and you should take advantage of that.
If you display in the browser data from Customer1, the Wicket knows that when you do requests from that page.
The translation of request parameters to variables happens behind the scene.
That is disconcerting at first but really powerful when used as intended.
I would suggest you select a good tutorial from the answer to this question and go through a couple of examples to see how things are done. This may take an afternoon but this will pay back for itself before the week is out.
我认为我有点太晚了,但我仍然会说您可以在页面中使用 PageParameters,并且应该使页面可添加书签。
I think I am a bit too late, but still I will say that you can use PageParameters in your page and you should make the page bookmarkable.