SCWCD1.4的資料

來源:互聯網
上載者:User

開始複習的是080。

看了幾位前輩的文章,才知道081和080有很大的不同。

以下為增加的兩部分,為EL和JSTL。

Chapter 7. Building JSP Pages Using the Expression Language (EL)
Given a scenario(方案;情況;概要), write EL code that accesses the following implicit variables including: pageScope, requestScope, sessionScope, and applicationScope, param and paramValues, header and headerValues, cookie, initParam and pageContext.
There are several implicit objects that are available to EL expressions used in JSP pages. These objects are always available under these names(講的是EL的隱含對象和簡單的說明)

然後舉了幾個例子,有EL的.運算和[]運算。
Chapter 9. Building JSP Pages Using Tag LibrariesFor a custom tag library or a library of Tag Files, create the 'taglib' directive for a JSP page.
The set of significant(有意義的, 重大的, 重要的) tags a JSP container interprets (解釋, 說明)can be extended through a tag library.

The taglib directive in a JSP page declares that the page uses a tag library, uniquely(獨特地,唯一地,珍奇地) identifies the tag library using a URI and associates(使發生聯絡, 使聯合) a tag prefix that will distinguish usage of the actions in the library.

If a JSP container implementation cannot locate a tag library description, a fatal translation error shall result.

It is a fatal translation error for the taglib directive to appear after actions or functions using the prefix.

In the following example, a tag library is introduced and made available to this page using the super prefix; no other tag libraries should be introduced in this page using this prefix. In this particular case, we assume the tag library includes a doMagic element type, which is used within the page.

JSTL增加的部分:
Given a design goal, use an appropriate(適當的) JSP Standard Tag Library (JSTL v1.1) tag from the "core" tag library.
The center of JSTL is the core taglib. This can be split into five areas:

General purpose

Variables support

Conditional

Iterator

URL Related



To use the core library, use the following directive:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>The prefix attribute specifies(指定,規定,確定) the prefix used in the tag name for a particular library. For example, the core library includes a tag named out. When combined with a prefix of c, the full tag would be <c:out>. You are free to use any prefix you like, but you must use different prefixes for each of the four standard tag libraries.

You must also put the corresponding(相應的) .tld file for each tag library in your /WEB-INF directory and use the taglib element in your web.xml file to include the tag library:

<taglib>    <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>    <taglib-location>/WEB-INF/tld/core.tld</taglib-location></taglib>

General purpose tags.

The general-purpose tags let you display variable values, and enclose(封閉,密封;封裝,包圍) a group of tags within a try-catch block.

The <c:out> action provides a capability(能力, 效能, 容量)similar to JSP expressions such as <%= scripting-language-expression %> or ${el-expression}. For example:





You have <c:out value="${sessionScope.user.itemCount}"/> items.

The <c:catch> action allows page authors to handle errors from any action in a uniform(統一的, 相同的) fashion, and allows for error handling for multiple actions at once. <c:catch> provides page authors with granular(粒度[狀) error handling: Actions that are of central importance to a page should not be encapsulated(密封) in a <c:catch>, so their exceptions will propagate to an error page, whereas actions with secondary importance to the page should be wrapped in a <c:catch>, so they never cause the error page mechanism to be invoked(調用). The exception thrown is stored in the scoped variable identified by var, which always has page scope. If no exception occurred, the scoped variable identified by var is removed if it existed. If var is missing, the exception is simply caught and not saved.

<c:catch [var="varName"]>nested(嵌套的) actions</c:catch>這部分基本上涉及了JSTL的所有內容。

包括<c:out><c:set><c:catch><c:when><c:choose><c:remove><c:forTokens><c:forEach><c:if>

還有<c:url><c:import><c:redirect>

詳細內容見http://java.boot.by/wcd-guide/ch09s03.html


相關文章

Beyond APAC's No.1 Cloud

19.6% IaaS Market Share in Asia Pacific - Gartner IT Service report, 2018

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

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

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