| 1 3 package madvoc; 4 5 import jodd.madvoc.interceptor.ScopeType; 6 import jodd.madvoc.meta.*; 7 import jodd.mutable.MutableInteger; 8 import jodd.petite.meta.PetiteBeanRef; 9 10 import javax.servlet.http.HttpServletResponse ; 11 import java.io.IOException ; 12 import java.util.List ; 13 import java.util.Map ; 14 15 import madvoc.biz.FooService; 16 17 20 @MadvocAction 21 @InterceptedBy(MyInterceptorStack.class) 22 public class HelloAction { 23 24 26 @In 27 private String name; 28 public void setName(String name) { 29 this.name = name + "xxx"; 30 } 31 32 @In 33 MutableInteger data; 34 35 @Out 36 String retv; 37 38 @PetiteBeanRef 39 FooService fooService; 41 42 46 public String world() { 47 System.out.println(">HelloAction.world " + name + data); 48 retv = " and Universe"; 49 fooService.hello(); 50 return "ok"; 51 } 52 53 55 @In("p") 56 Person person; 58 62 public String all() { 63 System.out.println(">HelloAction.all " + person); 64 return ""; 65 } 66 67 69 @In("ppp") 70 List <Person> plist; 71 72 @In("ppp") 73 Person[] parray; 74 75 @In("ppp") 76 Map <String , Person> pmap; 77 78 @In(scope=ScopeType.CONTEXT) 79 HttpServletResponse servletResponse; 80 81 85 public String again() throws IOException { 86 System.out.println(">HelloAction.again"); 87 88 if (plist == null) { 89 System.out.println("-"); 90 } else { 91 for (int i = 0; i < plist.size(); i++) { 92 System.out.println(i + " " + plist.get(i)); 93 } 94 } 95 96 if (parray == null) { 97 System.out.println("-"); 98 } else { 99 for (int i = 0; i < parray.length; i++) { 100 System.out.println(i + " " + parray[i]); 101 } 102 } 103 104 if (pmap == null) { 105 System.out.println("-"); 106 } else { 107 System.out.println(pmap); 108 } 109 110 111 servletResponse.getWriter().print("Direct stream output..."); 112 return null; 113 } 114 115 117 120 public String fff() { 121 System.out.println(">HelloAction.fff"); 122 return "forward:/hello.again.html"; 123 } 124 } 125 | Popular Tags |