SpringMvc:
@RequestMapping("/sayhi")
public String Sayhi(Model model,HttpServletRequest request) {
model.addAttribute("message", "Hello Spring MVC!");
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
System.err.println("path:"+path);
System.err.println("basepath:"+basePath);
return "hi";
}
JFinal:
public void index() {
HttpServletRequest request=getRequest();
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
System.err.println("path:"+path);
System.err.println("basepath:"+basePath);
render("index.html");
}
一样的写法,说明springmvc和jfinal还是有区别的。