学无止境

面朝大海,春暖花开

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

转发:地址不改变,是一个请求 默认为转发 将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,

posted on 2012-01-17 16:49  学+无止境  阅读(237)  评论(0编辑  收藏  举报