<input type=submit value="返回" onClick="history.go(-1);">

解决方案 »

  1.   

    <a href="javascript:history.go('a.htm')">
      

  2.   

    <input type=submit value="返回" onClick="history.go(-1);">
      

  3.   

    history.go(-1)试过了,也要等好长时间,不行..<a href="javascript:history.go('a.htm')">我返回的一定是要jsp动态生成的有没有别的好方法?
      

  4.   

    你不是返回时不刷新吗?怎么又要动态生成了?
    用 forward 关键字行不行
      

  5.   

    你误会我的意思了,我是说,返回到那个页面一定要是jsp的页面,不能返回到htm:)forward会刷新的吧?我试试去
      

  6.   

    <a href="javascript:history.back()"
    这样很快的啊,
    back里面不要用参数
      

  7.   

    // 重定向页面
       String request_url=request.getHeader("Referer");
       response.sendRedirect(request_url);
       return;
      

  8.   

    to:wjmmml(笑着悲伤)javascript:history.back()不快啊,我返回要40秒才返回啊,痛苦啊
      

  9.   

    to 7(Nomad) 能不能不在jsp里面转?我需要在IE里让人家点“返回”我才返回啊:)
      

  10.   

    history.go(-1)应该和在IE里点“返回”是一样的.
    你确认在IE里点“返回”就比这样快?
      

  11.   


    String request_url=request.getHeader("Referer");  
    out.print("<a href="+request_url+">返回</a>");
      

  12.   

    history.go(-1)应该和在IE里点“返回”的确是一样的我要的是不刷新页面的。我在IE里点“返回”也要40秒我觉得主要原因是刷新了页面,有没有不的?
      

  13.   

    to 7(Nomad) 这样还不是等于 <a href="a.jsp">返回</a>这样会刷新的吧?我试试看……
      

  14.   

    你是不是在jsp中设置了清楚缓存?
      

  15.   

    to: bhr(追风)应该没有:)to:  upc_chenli(chenli) 是比较大的数据啊,唉~~
      

  16.   

    比较大的数据?你又要求比较快。
    你重新显示A的时候需要从资源(例如数据库)中读取吗?如果是,有一个办法是放大数据放到session中,当然要大大牺牲服务器资源了,看你权衡的结果。
      

  17.   

    to Brain(无缺公子) 这个方法我也想过,还可以的,不过我想啊,为什么返回时一定要重新运行A.jsp啊?我明明已经运行过一次而且数据也传了过来了啊,所以我才想直接退回去就是了,所以才想问一下有没有不刷新的返回方法,谢谢:)to asset(书恒) 这个是根本,但目前还不能做到
      

  18.   

    哥们用重新定向的方法很好: response.sendRedirect(a.jsp);
       
      

  19.   

    jsp页面的过期时间好像是0吧,ie每次进入这个页面必然会刷新,不会从缓存中拿的,想办法优化你的响应时间吧,如果是统计结果你可以把他存起来下回再用啊
      

  20.   

    我认为是浏览器后退时,回对后退的页面(特别是CGI生成的)发送一个是否叶面已经过期的请求,你的机器收到浏览器的刷新请求,认为过期了,便重新执行相应的jsp叶面,但可能是你这个叶面需要的执行时间较长,从而使得要等30多秒,可以让上述的页面返回一个最后更改的时间为让一次执行的时候的时间,这样会使得后退回快一点,一个书上的例子:
    package mine;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Example using servlet initialization and the
    * getLastModified method.
    */
    public class LotteryNumbers extends HttpServlet {
        private long modTime;
        private int[] numbers = new int[10];
        /** The init method is called only when the servlet
        * is first loaded, before the first request
        * is processed.
        */
        public void init() throws ServletException {
            // Round to nearest second (ie 1000 milliseconds)
            modTime = System.currentTimeMillis()/1000*1000;
            for(int i=0; i<numbers.length; i++) {
                numbers[i] = randomNum();
            }
        }
        public void doGet(HttpServletRequest request,
        HttpServletResponse response)
        throws ServletException, IOException {
            response.setContentType("text/html");
            PrintWriter out = response.getWriter();
            String title = "Your Lottery Numbers";
            out.println(ServletUtilities.headWithTitle(title) +
            "<BODY BGCOLOR=\"#FDF5E6\">\n" +
            "<H1 ALIGN=CENTER>" + title + "</H1>\n" +
            "<B>Based upon extensive research of " +
            "astro-illogical trends, psychic farces, " +
            "and detailed statistical claptrap, " +
            "we have chosen the " + numbers.length +
            " best lottery numbers for you.</B>" +
            "<OL>");
            for(int i=0; i<numbers.length; i++) {
                out.println(" <LI>" + numbers[i]);
            }
            out.println("</OL>" +
            "</BODY></HTML>");
        }
        /** The standard service method compares this date
        * against any date specified in the If-Modified-Since
        * request header. If the getLastModified date is
        * later, or if there is no If-Modified-Since header,
        * the doGet method is called normally. But if the
        * getLastModified date is the same or earlier,
        * the service method sends back a 304 (Not Modified)
        * response, and does <B>not</B> call doGet.
        * The browser should use its cached version of
        * the page in such a case.
        */
        public long getLastModified(HttpServletRequest request) {
            return(modTime);
        }
        // A random int from 0 to 99.
        private int randomNum() {
            return((int)(Math.random() * 100));
        }
    }
    主要的函数在于:
        public long getLastModified(HttpServletRequest request) {
            return(modTime);
        }
    只是后退也会看到随机数并没有更改。
      

  21.   

    补充一下:上边的代码中的ServletUtilities.headWithTitle应该删去才可以通过。