[android] jsp的九大隱式對象,androidjsp

來源:互聯網
上載者:User

[android] jsp的九大隱式對象,androidjsp

pageContext對象:

1.可以作為入口對象擷取其他八大隱式對象的引用

1.1 getEXception擷取exception隱世對象

1.2 getPage擷取page對象

1.3 getRequest 擷取request對象

1.4 getResponse 擷取response對象

1.5 getServletConfig擷取config對象

1.6 getServletContext擷取application對象

1.7 getSession擷取session對象

1.8 getOut 擷取out對象

 

2.域對象,四大範圍的入口,可以操作四大範圍中的域屬性

作用範圍:當前jsp頁面

作用周期:頁面訪問開始時建立,結束時銷毀

 

四大範圍:

servletContext (application)

session (session)

reqquest (request)

pageContext

 

如果一個資料只在當前jsp頁面使用,可以使用pageContext域

如果一個資料,除了在當前Servlet中使用,還要在請求轉寄中使用,使用request域

如果一個資料,除了現在我自己要用,過一會我自己還要用,存在session域

如果一個資料,除了我自己用其他人也要用,存在ServleContext域中

3.jsp映射

  <servlet>

   <servlet-name>index</servlet-name>

   <jsp-file>/index.jsp</jsp-file>

  </servlet>

  <servlet-mapping>

   <servlet-name>index</servlet-name>

   <url-pattern>/jsp/*</url-pattern>

  </servlet-mapping>

 

 

Servlet響應請求產生資料,通過轉寄技術帶給jsp,資料的顯示jsp展示

Servlet是控制器,jsp是模板引擎

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.