转发:地址不改变,是一个请求 默认为转发 将redirect设置为true就变为重定向

重定向:地址改变了

<forward name=”login” path=”/login.jsp” redirect=”true”/>

设置全局的forward

<global-forwards>
        <forward name="login" path="/login.jsp" redirect="true"/>
    </global-forwards>

Struts配置文件运行期不允许修改

Struts的转发:return mapping.findForward(“login”);

自己的转发:respones.sendRedirect(request.getContextPath()+“/login.jsp”) ;  需要return null;

 

动态ActionForward

ActionForward af=new ActionForward();

af.setPath(“login”+page+”.jsp”);

ActionForward的属性:path,className,

相关文章:

  • 2022-12-23
  • 2021-10-17
猜你喜欢
  • 2021-06-02
  • 2021-06-22
  • 2022-02-10
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案