开发者

Create servlet in Wicket to pass input as a parameter on submit to the web page

开发者 https://www.devze.com 2023-02-24 06:46 出处:网络
I\'m new to Wicket and have m开发者_运维知识库ade an application using some tutorials. How do I create a servlet and pass on the input from that to a web page without database transactions?I\'m assum

I'm new to Wicket and have m开发者_运维知识库ade an application using some tutorials.

How do I create a servlet and pass on the input from that to a web page without database transactions?


I'm assuming you are trying redirect to a Wicket page (parameterized) from outside the Wicket application.

You can do this by using one of the URL encoding strategies (BookmarkablePageRequestTargetUrlCodingStrategy, QueryStringUrlCodingStrategy, ...) which will give that page a clean URL which can be referenced easily. Or you can put a BookmarkablePageLink in your web application somewhere, copy the link that it generates and use it to redirect to.

You can reference that link anywhere you wish passing parameters to it using the normal ?par1=val&par2=val system.

To read these parameters in your page you will need to define your page constructor like so:

...
public MyPage(final PageParameters parameters) {
    final String par1 = parameters.getString("par1");
    final String par2 = parameters.getString("par2");
}
...
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号