J2EE1.4 provides a new J2EE based Web Service in the development of tools to do a number of important enhancements, application deployment and server management also provides a new standard in integration and safety has improved to improve the J2EE Web application development capabilities; in programming model to the important changes include the JSP expression language to simplify the tag library, etc.; EJB 2.1 provides a new timer service, query language (QL) has also been enhanced; Jdbc3 .0 API to the usual Jdbc API API combined with the expansion; J2EE Connectors specification and independent of the message type of EJB provides support for two-way communication. Give you the following highlights J2EE1.4 contains JSP2.0, Servlet2.4, Jdbc3.0 and EJB2.1's new features.
JSP 2.0 is J2EE 1.4 platform, it is based on JSP 1.2 adds new features. It ensures backward compatibility, the original use of JSP technology can support both JSP 2.0. JSP 2.0 new features include the following sections:
(A) changes in operating environment
1, web.xml format change
We know that JSP 1.2 Java 2 Standard Edition can run the 1.3 version, while the JSP 2.0 requires Java 2 Standard Edition 1.4 or later, JSP 2.0 Servlet 2.4 using the procedure provided for Web deployment descriptor format.
Described in the file web.xml in the Web program to use xml schema Heading format. In web.xml, the main change is the setting for all information to the JSP on the tag. The following procedure Example 1 shows a general look web.xml.
Example 1:
2, JSP set
Provided in the marking process JSP Web program settings. Including and the two elements. Defines a Web program that uses the custom tag, it is used and previous use of the same in JSP 1.2. Defines a set of JSP features. These features actually correspond to the definition of JSP's page directive characteristics. But can be easily adopted with the same attributes to multiple JSP uniform definition.
Define one or more URL patterns, in the definition of property would apply to match the URL pattern for all JSP files. Attributes can be defined in the following settings:
(1) to allow or prohibit the use of expression language (EL)
Can set whether to allow in the corresponding JSP using JSTL expression language (EL). If the attribute tag is set to false, JSP EL expressions in will be processed; If it is true, Web container will be ignored when converting JSP EL expressions.
(2) to allow or prohibit the use of scripting
Property can allow or prohibit the use of JSP scripting language (scripting). If this attribute tag corresponds to true, the scripting element is banned, then can not use JSP scriptlet, scripting expressions and declaration, or there will be conversion errors. When this property is marked as false when, JSP can be done as before in the 1.2 version of the scripting language.
(3) Statement JSP code
Tag can be set by the corresponding JSP page encoding. This attribute corresponds to the pageEncoding attributes of each JSP, Web container will be based on the content of this attribute of the JSP code.
(4) corresponds to the implied, including (Implicit Includes)
In the JSP can be added in the corresponding rise of (preludes) and end (coda), use and attributes can be set in the JSP page, including the preludes and coda of jspf file. The location of the file relative to the current Web process context. When more than one preludes or coda element in time, JSP will follow the order to the content.
(B) introducing the expression language (EL)
A key feature of JSP 2.0 is that it supports the expression language (expression language). JSTL expression language can use the tag format for easy access to JSP implicit objects and JavaBeans components, JSTL core tags to provide a process and cycle control. Self made custom functions are also functions, so basically all seriptlet to achieve the functions can be replaced by the JSP. In JSP 2.0, it is recommended to make use of JSP EL Ershi more consistent format.
In the web.xml of a group can control whether to use JSP EL, in each JSP can also specify whether to use the JSP EL. In the page directive in the isELIgnored property specifies whether ignored. Format:
If true, then the JSP's expression is as string handling. The following example expression
$ (20) 2000%
In isELIgnored = “true” when the output is $ (20) 2000%, while the isELIgnored = “false” when the output is 100. Web container default isELIgnored = “false”.
Although the JSP 2.0 can use JSP expression language entirely avoid scriptlet, in the actual programming, functional requirements should be based on procedures and programming staff of its own conditions select the appropriate manner. JSP expression language using structured more convenient, but because of the need to mark the conversion, the first call will be relatively slow; some Java programmers because of better understanding, and therefore more used to the programming mode before JSP 1.2, so the use of should be selected in accordance with appropriate programming.
(C) SimpleTag
JSP 2.0 has added the new to create self-labeled API, javax.servlet.jsp.tagext.SimpleTag simple tag used to define the interface. And there are interfaces in JSP 1.2 is different, SimpleTag interface does not use the doStartTag () and doEndTag () method, which provides a simple doTag () method. This method is called when the tag is used only once. The need to implement a Self made all the logical process, circulation and body tags are all in the way the assessment is implemented. From this perspective, SimpleTag and IterationTag can achieve an equivalent role. But SimpleTag methods and processing cycle is much simpler. There is also used to set the SimpleTag JSP content seUspBody () and getJspBody () method. Web container will use setJspBody () method to define a representative of the content of JspFragment JSP object. The program can achieve SimpleTag tag doTag methods needed in multiple calls getJspBody (). Invoke () method to handle JSP content.
For example, the program cases of 2 SimpleTag according to a specified number of times (times) the output current loop and serial number (sequence). Procedure is relatively simple structure, all logic is implemented in doTag method.
Example 2:
(D) the use of JSP fragment
JSP2.0 a main function is to JSP fragment, it can handle the basic features of the container to defer assessment of JSP JSP tag attribute. We know that JSP is first assessed the general attributes of JSP tags, JSP tags and then use in dealing with these properties, and JSP fragment provides a dynamic property. In other words, these attributes in the JSP processing the tag body can be changed when. JSP needs to be such a property is defined as javax.servlet.jsp.tagext.JspFragment type. When set to this form of JSP tags, the attributes of this tag is similar to the treatment actually marked body. Procedures in achieving the tag, the tag attributes can be assessed several times repeated. This usage is called JSP fragment. JSP fragment can also be defined in a SimpleTag handler action used in homemade markers. Like the previous examples of, getJspBody JspFragment object and returns a method can be used multiple times in the doTag. Note that the use of JSP fragment of the JSP can only have a general text and JSP action, can not have scriptlet and scriptlet expressions.
We can simply think that JSP fragment is a reusable JSP. A JSP fragment can be passed to another and is used in JSP. With the JSP include the concept of difference is, JSP fragment generally relatively short and simple and functional re-use rate.
JSP fragment generally define the body tag or mark the body. Each time the tag containing the JSP fragment was used, Web container generates a JspFragment object, the object and the current link JSP's page scope. Moreover, the JspFragment object and contains links to its parent tag. JspFragment object can have two calls: Use tag handler written in Java, or use the tag files (tag file). Tag files can be used, or the action using the JSP fragment. JSP tag files and JSP fragment can work together. CustomTag are programmatically implemented. JSP tag file is a text file formats (JSP syntax) to achieve self-mark, which is a major new JSP 2.0 features. A tag file can correspond to a tag, you can define the tag without tld file method. Thus, even if the programmers are not familiar with Java, you can use JSP syntax to define their own tags. Tag files are generally used. Tag for the suffix and the program on the Web / WEB-INF directory.
Example 5 in the taskstatus.jsp program uses two JSP fragment. The JSP function is to show the name of a Task and completion dates, it is defined by two JSPfragment (name onSehedule and delayed). In the tag of the JSP is JSPfragment, and marked by a siege. This tag is a tag file defined by Self made, its definition files in / WEB-INF/tags directory. Tag file name and tag name the same as “listTasks.tag”. To the front of this tag will use the definition of the two JSP fragment.
Example 5:
(E) Other features
There are other features JSP2.0 changes, such as amendments to the I18N strict syntax rules of XML syntax in order to improve the corresponding JSP allows the use of namespaces and so on. These are not core functions, we can refer to java.sun.com feature relevant information about the details, not described here.
Recommended links:
MPG to DivX
Guo Wei code can take God Out of the “Red Sea”?
Fireworks produced hidden color photo
Head of the groundbreaking Xbox
3GPP to WMV
Switch to the best Period of 2 to 3 years
Directory Desktop
Initial bitmap
BEA loneliness
Unihub To come from BEHIND
Thunder ruthless anti-piracy or abandoned by advertisers
Analysis Of Uml Workflow Management System I
MPEG4 to MPEG
Source Editors comments