01: /*
02: * $Id: Page2.java 462276 2006-09-16 21:51:33Z ehillenius $ $Revision: 462276 $ $Date:
03: * 2006-03-14 09:57:54 +0000 (Di, 14 Mrz 2006) $
04: *
05: * ==================================================================== Licensed
06: * under the Apache License, Version 2.0 (the "License"); you may not use this
07: * file except in compliance with the License. You may obtain a copy of the
08: * License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15: * License for the specific language governing permissions and limitations under
16: * the License.
17: */
18: package wicket.examples.niceurl;
19:
20: import java.util.Random;
21:
22: import wicket.PageParameters;
23: import wicket.examples.WicketExamplePage;
24: import wicket.markup.html.basic.Label;
25: import wicket.markup.html.link.BookmarkablePageLink;
26:
27: /**
28: * Simple bookmarkable page that displays page parameters.
29: *
30: * @author Igor Vaynberg
31: */
32: public class Page2 extends WicketExamplePage {
33: private Random random = new Random();
34:
35: /**
36: * Constructor
37: *
38: * @param parameters
39: */
40: public Page2(PageParameters parameters) {
41: String p1 = "CANNOT RESOLVE FROM URL";
42: if (parameters.containsKey("param1")) {
43: p1 = parameters.getString("param1");
44: }
45: String p2 = "CANNOT RESOLVE FROM URL";
46: if (parameters.containsKey("param2")) {
47: p2 = parameters.getString("param2");
48: }
49:
50: add(new Label("p1", p1));
51: add(new Label("p2", p2));
52:
53: String newP1 = String.valueOf(random.nextInt());
54: String newP2 = String.valueOf(random.nextInt());
55:
56: PageParameters params = new PageParameters();
57: params.put("param1", newP1 + " " + newP2);
58: params.put("param2", newP2 + " " + newP1);
59:
60: BookmarkablePageLink link = new BookmarkablePageLink(
61: "refreshLink", getClass(), params);
62: add(link);
63:
64: add(new BookmarkablePageLink("homeLink", Home.class));
65: }
66: }
|