TestRouteView.java
1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package org.legrog.web.xyz;
import org.ocpsoft.rewrite.annotation.Join;
import org.ocpsoft.rewrite.annotation.Parameter;
import org.ocpsoft.rewrite.annotation.RequestAction;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
import java.io.Serializable;
@Named
@RequestScoped
@Join(path = "/TestRoute/{bar}", to = "/xyz/TestRoute.jsf")
public class TestRouteView implements Serializable {
String foo = "my first String";
String tar = "It's a pit!";
@Parameter
String bar;
@RequestAction
public void init() {
if (bar == null) {
foo = "my modified string without bar";
} else {
foo = "my string modified with "+ bar;
try {
Integer barnum = new Integer(bar);
tar = "The value converts into an integer " + barnum;
} catch (NumberFormatException ne) {
tar = "The value "+ bar +" doesn't convert into an integer";
}
}
}
public String getFoo() {
return foo;
}
public void setFoo(String foo) {
this.foo = foo;
}
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
public String getTar() {
return tar;
}
public void setTar(String tar) {
this.tar = tar;
}
}