@Resource public class UserResource { private @In HttpServletRequest request;//用@In注入http对象,request,session等 @Service("helloService") private HelloService helloService;//用@Service注入jdon管理的service @Path("/") public Renderer index() { User user = helloService.getUser("999"); return new TemplateRenderer("/index.htm", "user", user);//借鉴sping mvc的跳转 } } <p class="indent">
[该贴被oojdon于2010-04-05 14:26修改过]
[该贴被oojdon于2010-07-09 09:27修改过]
private String getHttpMethod(WebRequest request){ String methodName = request.getRequest().getParameter(OVERLOAD_POST); if (methodName == null) { methodName = request.getRequest().getMethod(); methodName = methodName.toUpperCase(); } else if ("GET".equalsIgnoreCase(request.getRequest().getMethod())) { throw new IllegalArgumentException("You can't use " + OVERLOAD_POST + " parameter on a GET request. Use POST instead."); } log.info("---->the http method is:"+methodName); return methodName; } <p class="indent">
[该贴被oojdon于2010-04-07 15:06修改过]
http://code.google.com/p/jdonmvc/CRUD的demo:http://code.google.com/p/jdonmvc/downloads/list框架代码完全通过了findbugs的检查,没有任何警告。
[该贴被oojdon于2010-04-11 19:44修改过]
@Path("/") public Represent index() { List<User> userlist = helloService.getUserList(); return new Html("/index.ctl", "userlist", userlist); } <p class="indent">
[该贴被oojdon于2010-04-13 15:14修改过]
猜你喜欢
其他人在看