1 import java.io.*; 2 import java.util.*; 3 import javax.servlet.*; 4 import javax.servlet.http.*; 5 6 import jodd.servlet.*; 7 8 9 public class MvcAction2 extends ActionServlet { 10 11 22 public String go(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { 23 System.out.println("---------------"); 24 System.out.println("MvcAction2.go()"); 25 System.out.println(">ACTION:go"); 26 return "ok"; 27 } 28 29 30 public String go2(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { 31 System.out.println("---------------"); 32 System.out.println("MvcAction2.go2()"); 33 System.out.println(">ACTION:go2"); 34 HashMap map = (HashMap) request.getAttribute(ActionController.INVOKE_ACTION_PARAMS); 35 if (map != null) { 36 return "ok?id=" + map.get("id"); 37 } 38 return "ok?id=1"; 39 } 40 41 public String go3(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { 42 System.out.println("---------------"); 43 System.out.println("MvcAction2.go3()"); 44 System.out.println(">ACTION:go3"); 45 String externalResult = invokeExternalAction(request, response, "/mvc2/params.do?id=2"); System.out.println("external results = " + externalResult); 47 return externalResult; 48 } 49 50 public String doMap(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { 51 System.out.println("one action handler for 3 requests!"); 52 System.out.println("current request:" + getActionParameter(request, "mparam")); 53 System.out.println("param #2:" + getActionParameter(request, "only2")); 54 System.out.println("param #2.2:" + getActionParameter(request, "only2.2")); 55 return "ok"; 56 } 57 } 58 59 | Popular Tags |