jsp to wicket page , how to create url using page parameters

540 views Asked by At

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

1

There are 1 answers

0
Martin Strejc On

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