本帖最后由 aimatwinning 于 2013-11-26 23:22:23 编辑

解决方案 »

  1.   

    if("aa".equals(name)){
    if("123".equals(pwd)){
    request.getRequestDispatcher("/form/success.html")
                .forward(request, response);//这是内部跳转
    }else{
    request.getRequestDispatcher("form/error.html")
                .include(request, response);//这是内部跳转
    }
    }else{
    response.sendRedirect("/MyServlet/form/error.html");//服务器外部跳转
    }
      

  2.   

    额...可以参考《Tomcat与Java Web开发技术详解》(孙卫琴) 5.6 转发和包含 5.7 重定向
    我博客也有一篇简单总结:
    http://blog.csdn.net/forrest_chen/article/details/16975271
    希望给你帮助
      

  3.   

    查查forward 和redirect的区别就明白了
      

  4.   

    forward:转发
    redirect:重定向。
    都支持后台代码内部跳转。
      

  5.   


    Dispthcher 和Redirect 页面改变而url不改变吗?
      

  6.   

    我要实现的是 用jsp写成的系统  在页面上点了某个按钮后  功能照常执行, 而地址栏的url不改变.  我说的是这个服务器内部跳转
      

  7.   


    queryForm1.target 指向一个隐藏的iframe
      

  8.   

    把想隐藏url的跳转指向另一个frame,该frame嵌套在主框架之内,url只显示主框架的地址。
      

  9.   

    /**
     * @author 
     * 
     */
    @Results({ @Result(name = "result", location = "/${nextAction}", type = "redirect") })
    public class EchoAction extends EditAction { /**
     * 
     */
    private static final long serialVersionUID = 1L; private String echo;
    private String nextAction; /*
     * (非 Javadoc)
     * 
     * @see com.opensymphony.xwork2.ActionSupport#execute()
     */
    @Override
    public String execute() throws Exception {
    String url = ServletActionContext.getRequest().getParameter("echo");
    System.out.println(">>>>>>>>>>>>>>>>>>>>" + url);
    if (StringUtils.isBlank(url))
    this.nextAction = "system/user-list";
    else
    this.nextAction = "system/user-list";
    // this.nextAction = url;
    return "result";
    } /**
     * @return nextAction
     */
    public String getNextAction() {
    return nextAction;
    } /**
     * @param nextAction
     *            要设置的 nextAction
     */
    public void setNextAction(String nextAction) {
    this.nextAction = nextAction;
    } /**
     * @return echo
     */
    public String getEcho() {
    return echo;
    } /**
     * @param echo 要设置的 echo
     */
    public void setEcho(String echo) {
    this.echo = echo;
    }}
      

  10.   


    好像是我想要的,  具体怎么做 指点一二
    1.网站首页(main.html)主要分为上下两部分框架(frame),上位banner,下为content.
    2.登陆之后直接跳转到main.html,之后的所有跳转都在content所在的frame中,则url始终为首页的url.
      

  11.   

    servlet一共只有两种跳转redirect和forward,无论你用struts还是spring mvc底层都一样。不改变地址的跳转就是forward
      

  12.   

    <div id="center-panel" style="margin-top:5px;overflow: hidden;">
    <iframe id="content-frame"  name="content-frame"  frameborder="0"  src="welcome.html"    
     style="border: none ; width: 100% ; _width:100% ; height:100%; "></iframe>
     </div>
    这样写使<iframe>为你的context区域,要跳转直接在js里面修改src链接就OK了,,地址永远是你的首页地址。不用谢,,求分
      

  13.   

    楼主还是用框架吧,easyUI, ext,dojo 都可以, 打开你的项目看起来你的也没从来都没跳转过. 不知道这是不是你想要的.