Java web中的重定向使用的是HttpServletResponse.sendRdirect(String url)方法。
Play也可以重定向,但它的response()方法没有重定向功能,直接在Controller中使用它的redirect(String url)方法即可:
public class SomeAction extends Controller{
public static Result gohome(){
return redirect("/index");
}
}
本文介绍了在Play框架中实现重定向的方法。不同于Javaweb中的HttpServletResponse.sendRedirect(String url),Play框架采用Controller中的redirect(String url)来实现页面跳转。
31

被折叠的 条评论
为什么被折叠?



