public class AdminLoginInterceptor implements Interceptor { @Inject AccountService accountService; @Override public void intercept(Invocation inv) { BaseAction baseAction = (BaseAction) inv.getController(); if (StringUtil.isBlank(AccountService.SESSIONID_USER.get(baseAction.getSession().getId()))) { if (baseAction.isAjax()) { baseAction.renderJson(new Response(GlobalConstant.CODE_REQUEST_ERROR, "您的账号已经在另一处登录了,你被迫下线!")); return; } baseAction.setAttr("msg", "您的账号已经在另一处登录了,你被迫下线!"); String loginUrl = new String("/admin/account/loginPage?returnUrl="+inv.getActionKey()); String queryString = baseAction.getRequest().getQueryString(); if (StringUtil.isNotBlank(queryString)) { loginUrl += "&"+queryString; } baseAction.forwardAction(loginUrl); // baseAction.redirect(loginUrl); return; } inv.invoke(); } }
loginUrl路径是正确的
使用 baseAction.forwardAction(loginUrl); 始终报404
使用 baseAction.redirect(loginUrl); 可以跳转正常
请问报404的原因?
项目:JFinal
404 这个事没有什么技巧,将路由改对就好