把具体的错位贴出来,如果可以的话,把source也贴出来.

解决方案 »

  1.   

    你是不是设置了过期时间和 cache。如果你只设置了其中一样,建议你把另一样也相应的设置好。
      

  2.   

    问题已解决 不忍就此结贴 我布置一listener,如何使用response request等对象操作servlet 或 jsp页面呢? 编译器自动生成代码如下:package untitled1;import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    //import javax.servlet.http.* ;
    import javax.servlet.jsp.*;public class MySessionBindListenter extends HttpServlet implements HttpSessionListener, HttpSessionAttributeListener
    {
    //Notification that a session was created
      public void sessionCreated(HttpSessionEvent se )
      {
        
       // out.println("<html><script>alert('This is test !')</script></html>");
     //    throw new java.lang.UnsupportedOperationException("Method sessionCreated() not yet implemented.");
      }  //Notification that a session was invalidated
      public void sessionDestroyed(HttpSessionEvent se)
      {
     //   throw new java.lang.UnsupportedOperationException("Method sessionDestroyed() not yet implemented.");
      }  //Notification that a new attribute has been added to a session
      public void attributeAdded(HttpSessionBindingEvent se)
      {
    //javax.servlet.ServletContext.getContext()
      //  throw new java.lang.UnsupportedOperationException("Method attributeAdded() not yet implemented.");
      }  //Notification that an attribute has been removed from a session
      public void attributeRemoved(HttpSessionBindingEvent se)
      {
       // throw new java.lang.UnsupportedOperationException("Method attributeRemoved() not yet implemented.");
      }  //Notification that an attribute of a session has been replaced
      public void attributeReplaced(HttpSessionBindingEvent se)
      {
    //    throw new java.lang.UnsupportedOperationException("Method attributeReplaced() not yet implemented.");
      }
    }
      

  3.   

    public class SetCharacterEncodingFilter
        implements Filter {
      protected String encoding = null;
      protected FilterConfig filterConfig = null;
      protected boolean ignore = true;
      public void destroy() {    this.encoding = null;
        this.filterConfig = null;  }  public void doFilter(ServletRequest request, ServletResponse response,
                           FilterChain chain) throws IOException, ServletException {
         //System.out.println("request.getCharacterEncoding()"+request.getCharacterEncoding());
        if (ignore || (request.getCharacterEncoding() == null)) {
          String encoding = selectEncoding(request);
          if (encoding != null) {
            request.setCharacterEncoding(encoding);
          }
        }
        chain.doFilter(request, response);
      }
      public void init(FilterConfig filterConfig) throws ServletException {    this.filterConfig = filterConfig;
        this.encoding = filterConfig.getInitParameter("encoding");
        String value = filterConfig.getInitParameter("ignore");
        if (value == null) {
          this.ignore = true;
        }
        else if (value.equalsIgnoreCase("true")) {
          this.ignore = true;
        }
        else if (value.equalsIgnoreCase("yes")) {
          this.ignore = true;
        }
        else {
          this.ignore = false;
        }  }
      protected String selectEncoding(ServletRequest request) {    return (this.encoding);  }}
      

  4.   

    不是  是我贴出的代码好像不能直接调用resquest这些对象啊