⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 session_0002dcookie_0002ejsp_jsp.java

📁 用JAVA编写的JSP程序
💻 JAVA
字号:
import java.util.*;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;


public class Session_0002dCookie_0002ejsp_jsp extends HttpJspBase {

    // begin [file="/Session-Cookie.jsp";from=(47,3);to=(50,0)]
        
        int count1=0;
        int count2=0;
    // end

    static {
    }
    public Session_0002dCookie_0002ejsp_jsp( ) {
    }

    private static boolean _jspx_inited = false;

    public final void _jspx_init() throws org.apache.jasper.runtime.JspException {
    }

    public void _jspService(HttpServletRequest request, HttpServletResponse  response)
        throws java.io.IOException, ServletException {

        JspFactory _jspxFactory = null;
        PageContext pageContext = null;
        HttpSession session = null;
        ServletContext application = null;
        ServletConfig config = null;
        JspWriter out = null;
        Object page = this;
        String  _value = null;
        try {

            if (_jspx_inited == false) {
                synchronized (this) {
                    if (_jspx_inited == false) {
                        _jspx_init();
                        _jspx_inited = true;
                    }
                }
            }
            _jspxFactory = JspFactory.getDefaultFactory();
            response.setContentType("text/html;ISO-8859-1");
            pageContext = _jspxFactory.getPageContext(this, request, response,
            			"", true, 8192, true);

            application = pageContext.getServletContext();
            config = pageContext.getServletConfig();
            session = pageContext.getSession();
            out = pageContext.getOut();

            // HTML // begin [file="/Session-Cookie.jsp";from=(2,4);to=(3,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(3,60);to=(6,2)]
                out.write("\r\n<html>\r\n<body bgcolor=\"#ffffff\">\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(6,4);to=(8,2)]
                
                  String sessionID=session.getId();
                  
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(8,4);to=(10,12)]
                out.write("\r\n<h1>\r\n  SessionID:");

            // end
            // begin [file="/Session-Cookie.jsp";from=(10,15);to=(10,24)]
                out.print(sessionID);
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(10,26);to=(14,2)]
                out.write("\r\n</h1>\r\n<h2>\r\n  OldMaxInactiveInterval=\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(14,5);to=(14,37)]
                out.print(session.getMaxInactiveInterval());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(14,39);to=(17,2)]
                out.write("\r\n</h2>\r\n<h2>\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(17,4);to=(17,38)]
                session.setMaxInactiveInterval(6);
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(17,40);to=(19,2)]
                out.write("\r\n  NewMaxInactiveInterval=\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(19,5);to=(19,37)]
                out.print(session.getMaxInactiveInterval());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(19,39);to=(22,14)]
                out.write("\r\n</h2>\r\n<p>\r\n  Session.New?");

            // end
            // begin [file="/Session-Cookie.jsp";from=(22,17);to=(22,32)]
                out.print(session.isNew());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(22,34);to=(24,0)]
                out.write("\r\n</p>\r\n");

            // end
            // begin [file="/Session-Cookie.jsp";from=(24,2);to=(28,0)]
                
                Cookie[] cookie=request.getCookies();
                for(int i=0;i<cookie.length;i++)
                {
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(28,2);to=(31,2)]
                out.write("\r\n<p>\r\n  CookieName\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(31,5);to=(31,24)]
                out.print(cookie[i].getName());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(31,26);to=(35,2)]
                out.write("\r\n</p>\r\n<p>\r\n  CookieValue\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(35,5);to=(35,25)]
                out.print(cookie[i].getValue());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(35,27);to=(39,2)]
                out.write("\r\n</p>\r\n<p>\r\n  Old max age in seconds:\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(39,5);to=(39,26)]
                out.print(cookie[i].getMaxAge());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(39,28);to=(43,2)]
                out.write("\r\n</p>\r\n<p>\r\n  New max age in seconds:\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(43,4);to=(43,27)]
                cookie[i].setMaxAge(0);
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(43,29);to=(44,2)]
                out.write("\r\n  ");

            // end
            // begin [file="/Session-Cookie.jsp";from=(44,5);to=(44,26)]
                out.print(cookie[i].getMaxAge());
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(44,28);to=(46,0)]
                out.write("\r\n</p>\r\n");

            // end
            // begin [file="/Session-Cookie.jsp";from=(46,2);to=(46,3)]
                }
            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(46,5);to=(47,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(50,2);to=(51,0)]
                out.write("\r\n");

            // end
            // HTML // begin [file="/Session-Cookie.jsp";from=(55,4);to=(58,0)]
                out.write("\r\n</body>\r\n</html>\r\n");

            // end

        } catch (Throwable t) {
            if (out != null && out.getBufferSize() != 0)
                out.clearBuffer();
            if (pageContext != null) pageContext.handlePageException(t);
        } finally {
            if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -