0
|
1 package nabble.view.web.template;
|
|
2
|
|
3 import nabble.naml.compiler.Command;
|
|
4 import nabble.naml.compiler.CommandSpec;
|
|
5 import nabble.naml.compiler.IPrintWriter;
|
|
6 import nabble.naml.compiler.Interpreter;
|
|
7 import nabble.naml.compiler.Namespace;
|
|
8
|
|
9 import javax.servlet.http.HttpServletRequest;
|
|
10
|
|
11
|
|
12 @Namespace (
|
|
13 name = "field",
|
|
14 global = false
|
|
15 )
|
|
16 public class FieldNamespace {
|
|
17 private final String name;
|
|
18 private String value = null;
|
|
19
|
|
20 public FieldNamespace(String name) {
|
|
21 this.name = name;
|
|
22 }
|
|
23
|
|
24 public String getName() {
|
|
25 return name;
|
|
26 }
|
|
27
|
|
28 public void setValue(String value) {
|
|
29 this.value = value;
|
|
30 }
|
|
31
|
|
32 public void setValue(HttpServletRequest request) {
|
|
33 this.value = request.getParameter(name);
|
|
34 }
|
|
35
|
|
36 public String getValue() {
|
|
37 return value;
|
|
38 }
|
|
39
|
|
40 @Command("name") public void _name(IPrintWriter out,Interpreter interp) {
|
|
41 out.print(name);
|
|
42 }
|
|
43
|
|
44 @Command("value") public void _value(IPrintWriter out,Interpreter interp) {
|
|
45 out.print(interp.encode(value));
|
|
46 }
|
|
47
|
|
48 public static final CommandSpec set_value = CommandSpec.NO_OUTPUT()
|
|
49 .dotParameter("value")
|
|
50 .build()
|
|
51 ;
|
|
52
|
|
53 @Command public void set_value(IPrintWriter out,Interpreter interp) {
|
|
54 setValue( interp.getArgString("value") );
|
|
55 }
|
|
56
|
|
57 }
|