Reputation: 1534
i am inside jsp page and i want to redirect to a wicket page
for instance :
http://localhost:8080/myWicketApp/myPage/?abc=2&&def=3
how can i pass a valid url to wickt where the get params converted to page paramters myPage(pageParameters pageParameters){ pageParameters.get("abc");//==2 }
or any other way to pass parameters and create url with parameters
Upvotes: 1
Views: 537
Reputation: 4347
As you mentioned Wicket uses its PageParameters as parameter wrapper. To pass paramaters to your class you have to implement constructor
MyPage(PageParameters pageParameters)
{
super(pageParameters);
...
}
When you request an URL, e.g.
http://localhost:8080/myWicketApp/myPage/?abc=2&def=3
You can reach the parameters by their names or index
pageParametrs.get("abc").toString(); // return "2"
pageParametrs.get("def").toString(); // return "3"
pageParametrs.get(1).toString(); // returns "2"
pageParametrs.get(2).toString(); // returns "3"
If you want to create the URL
// on any Componet
setResponsePage(MyPage.class, new PageParameters().add("abc", 2).add("def", 3));
Page parameters is an immutable class used to store/recieve parameters, see http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/request/mapper/parameter/PageParameters.html
Upvotes: 2