<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Dict.CN 在線詞典, 英語學(xué)習(xí), 在線翻譯

    都市淘沙者

    荔枝FM Everyone can be host

    統(tǒng)計(jì)

    留言簿(23)

    積分與排名

    優(yōu)秀學(xué)習(xí)網(wǎng)站

    友情連接

    閱讀排行榜

    評(píng)論排行榜

    JSP中與路徑相關(guān)的常用的幾個(gè)方法

    http:/localhost/123/jsp/test.jsp:

    <%@ page language="java" pageEncoding="UTF-8"%>

     

    <%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>

    <%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>

    <%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>

    <%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles" %>

     

     

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

    <html:html lang="true">

      <head>

        <html:base />

       

        <title>test.jsp</title>

     

        <meta http-equiv="pragma" content="no-cache">

        <meta http-equiv="cache-control" content="no-cache">

        <meta http-equiv="expires" content="0">   

        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">

        <meta http-equiv="description" content="This is my page">

        <!--

        <link rel="stylesheet" type="text/css" href="styles.css">

        -->

     

      </head>

     

      <body>

    <p>

        <h2>application - javax.servlet.ServletContext</h2>

        application.getRealPath("/")<%=application.getRealPath("/") %><br>

        application.getMajorVersion() - <%=application.getMajorVersion() %><br>

        application.getMimeType("txt") - <%=application.getMimeType("txt") %><br>

        application.getServerInfo() - <%=application.getServerInfo() %><br>

        application.getServletContextName() - <%=application.getServletContextName() %><br>

        application.getContext()

    </p>

     

    <p>

        <h2>config - javax.servlet.ServletConfig</h2>

        config.getServletName() - <%=config.getServletName() %><br>

        config.getServletContext()<br>

    </p>

     

    <p>

        <h2>pageContext - javax.servlet.jsp.PageContext</h2>

        pageContext.getRequest()JSP中的requset隱式對(duì)象)<br>

        pageContext.getResponse()JSP中的response隱式對(duì)象)<br>

        pageContext.getServletConfig()JSP中的config隱式對(duì)象)<br>

        pageContext.getServletContext()JSP中的application隱式對(duì)象)<br>

        pageContext.getException()JSP中的exception隱式對(duì)象)<br>

        pageContext.getSession()JSP中的session隱式對(duì)象)<br>

        pageContext.getOut()JSP中的out隱式對(duì)象)

    </p>

     

    <p>

        <h2>request - javax.servlet.http.HttpServletRequest</h2>

        request.getLocalAddr() - <%=request.getLocalAddr() %><br>

        request.getServletPath() - <%=request.getServletPath() %><br>

        request.getContextPath() - <%=request.getContextPath() %><br>

        request.getLocalName() - <%=request.getLocalName() %><br>

        request.getLocalPort() - <%=request.getLocalPort() %><br>

        request.getPathInfo() - <%=request.getPathInfo() %><br>

        request.getProtocol() - <%=request.getProtocol() %><br>

        request.getQueryString() - <%=request.getQueryString() %><br>

        request.getRemoteAddr() - <%=request.getRemoteAddr() %><br>

        request.getRemoteHost() - <%=request.getRemoteHost() %><br>

        request.getRemotePort() - <%=request.getRemotePort() %><br>

        request.getRemoteUser() - <%=request.getRemoteUser() %><br>

        request.getRequestedSessionId():<%=request.getRequestedSessionId() %><br>

        request.getRequestURI() - <%=request.getRequestURI() %><br>

        request.getRequestURL() - <%=request.getRequestURL() %>

    </p>

     

    <p>

        <h2>session - javax.servlet.http.HttpSession</h2>

        session.getServletContext()

    </p>

     

      </body>

    </html:html>

    客戶端顯示如下:

    application - javax.servlet.ServletContext

    application.getRealPath("/")F:\workspace\tomcat\123\
    application.getMajorVersion() - 2
    application.getMimeType("txt") - null
    application.getServerInfo() - Apache Tomcat/5.0.30
    application.getServletContextName() - null
    application.getContext()

    config - javax.servlet.ServletConfig

    config.getServletName() - jsp
    config.getServletContext()

    pageContext - javax.servlet.jsp.PageContext

    pageContext.getRequest()
    pageContext.getResponse()
    pageContext.getServletConfig()
    pageContext.getServletContext()
    pageContext.getException()
    pageContext.getSession()
    pageContext.getOut()

    request - javax.servlet.http.HttpServletRequest

    request.getLocalAddr() - 127.0.0.1
    request.getServletPath() - /jsp/test.jsp
    request.getContextPath() - /123
    request.getLocalName() - 127.0.0.1
    request.getLocalPort() - 80
    request.getPathInfo() - null
    request.getProtocol() - HTTP/1.1
    request.getQueryString() - null
    request.getRemoteAddr() - 127.0.0.1
    request.getRemoteHost() - 127.0.0.1
    request.getRemotePort() - 1211
    request.getRemoteUser() - null
    request.getRequestedSessionId():5AFAE9C0A164621D4F8E0DAF2F253C92
    request.getRequestURI() - /123/jsp/test.jsp
    request.getRequestURL() - http://localhost/123/jsp/test.jsp

    session - javax.servlet.http.HttpSession

    session.getServletContext()

    注:

    http://localhost/123/taglib/html/result.jsp中使用以下方法

    request.getServletPath() :返回request的請(qǐng)求路徑的相對(duì)于應(yīng)用程序的相對(duì)路徑

    request.getContextPath()返回應(yīng)用程序上下文相對(duì)路徑

    this.getRealPath(String str)返回UILstr對(duì)應(yīng)于本地磁盤的絕對(duì)路徑

    request.getLocalAddr() 返回服務(wù)器IP地址

    posted on 2007-12-01 12:58 都市淘沙者 閱讀(922) 評(píng)論(0)  編輯  收藏 所屬分類: Java Basic/Lucene/開源資料

    主站蜘蛛池模板: 成人性做爰aaa片免费看| 一级免费黄色毛片| 美女一级毛片免费观看| www免费黄色网| 毛片在线播放免费观看| 免费h片在线观看网址最新| 最近的免费中文字幕视频| 国产又粗又猛又爽又黄的免费视频 | 亚洲AV无码一区二区三区牛牛| 亚洲国产精品无码久久久秋霞1| 无人视频在线观看免费播放影院| 国产在线国偷精品免费看| 37pao成人国产永久免费视频| 无码高潮少妇毛多水多水免费| 又黄又爽一线毛片免费观看| 国产亚洲色婷婷久久99精品91| 亚洲欧洲一区二区| 亚洲色大成网站www| 国产精品99爱免费视频| 在线成人爽a毛片免费软件| 日韩成人在线免费视频| 久久亚洲综合色一区二区三区| 亚洲人成伊人成综合网久久| 国产区图片区小说区亚洲区| 九九美女网站免费| 毛片a级毛片免费观看免下载| 亚洲国产成人VA在线观看| 亚洲视频中文字幕在线| 美女啪啪网站又黄又免费| 色猫咪免费人成网站在线观看 | 麻豆国产入口在线观看免费| 亚洲中文字幕无码爆乳AV| 亚洲噜噜噜噜噜影院在线播放| 污网站在线免费观看| 永久看日本大片免费35分钟| 亚洲AV成人精品日韩一区18p| 亚洲天堂中文资源| 无码毛片一区二区三区视频免费播放| 亚洲一区二区三区免费观看| 亚洲高清最新av网站| va天堂va亚洲va影视中文字幕|