Saturday, October 23, 2010

JSP variable in the scope of the specification



JavaServer Pages (JSP) and JSP Standard Tag Library specification (JSTL) to Web developers to provide many useful tags (also known as operations). In addition, JSP 2.0 also provides two API, which is the standard API and simple tags tags API, used to build custom tags / operation. Inherited from the previous API JSP 1.x, and due to historical reasons, the use by the JSTL. (Due to the development of JSTL 1.0 in JSP 2.0 before, so the new API does not include JSTL 1.1.) Moreover, JSTL does not use JSP fragment and dynamic properties of the new features such as JSP. This article uses the JSP 2.0 API and features of the new build custom tag extensions JSTL. This article provides an overview of API and demonstrates how to develop

鈼?Export variable tag

鈼?conditions of tags

鈼?iteration mark

鈼?dynamic properties of the tag

鈼?Coordination tag

Simple tag API Overview

In JSP pages using custom tags, the application server JSP container will convert the call ... as tag processing methods like Java code. Therefore, if you want to develop custom tag, you must provide a tag handler, such standards must be marked using JSP 1.x API or the JSP 2.0 simple tag API. Compare these two API, will find the new API easier to use. Only a simple tag API Interface (javax.servlet.jsp.tagext.SimpleTag), which defines the method of dealing with custom tags. Usually from the JSP container automatically generated from the JSP page in the Java Servlet to call these methods.

javax.servlet.jsp.tagext.SimpleTagSupport class implements SimpleTag interface, so when the mark when dealing with only the preparation of an Extended SimpleTagSupport doTag () method can be. The following steps describe how to develop a simple tag handler class:

Step 1: Design custom tag

First, you must choose a name tag and set its properties. Then, create a tag library descriptor (TLD) file (using the JSP specification defines the XML format) to inform the JSP container how to handle and verify the custom tag. Text provides a sample TLD file called util.tld.

Step 2: Create tag handling class

Must provide an interface for achieve SimpleTag Java classes. The easiest way is to extend SimpleTagSupport or one of its subclasses. In this article VarTagSupport, IfTag and WhileTag class for extending SimpleTagSupport. Examples of other tag handler extension VarTagSupport.

If you want to use is not specified in the TLD file attributes, then the tag handler must implement the javax.servlet.jsp.tagext.DynamicAttributes interface (such as "dynamic attributes of the tag" section describes the MapTag example below).

Step 3: Initialize tag handle class instance

Each tag handling class must contain a public no arguments constructor for placing the initialization code. In this article address some of the tag type (EvalTag, ListTag and MapTag) contains a public constructor without parameters, it uses the default values instance variables initialized. Other (IfTag, WhileTag and ItemTag) no constructor. Please note, Java compiler in the class does not contain any constructors to automatically generate a public constructor without parameters, this function does not do anything.

Step 4: Method of providing property

JSP page tag attribute values through the setAttribute () method is passed to the tag handler. For example, this article includes four tag attributes: var, scope, expr and type. EvalTag handling class implements setExpr () and setType () method, inherited from the VarTagSupport setVar () and setScope ().

Dynamic properties of interfaces defined by DynamicAttributes setDynamicAttribute () method of delivery.

Step 5: Implement doTag () method

The method used to implement custom tag logic. doTag () method by the JSP container, after following all the property set method call. Here you can use getJspContext () to get a javax.servlet.jsp.JspContext object to access the JSP environment. Can call getJspBody (), which returns javax.servlet.jsp.tagext.JspFragment instance, the instance that is located in the main body and between the JSP. If you work together to develop the tags, such as and (the last part of this article will be introducing its), you can also use the getParent () and findAncestorWithClass () method.

Step 6: Test the custom tag

JSP pages using custom tags to use the tag directive to import the tag library. When the custom tag in JSP page, when, JSP container generates the class instance to create tag handling, call the property method and call doTag () method code. Therefore, the use of JSP custom tag implementation of the page call tag will handle class methods.

Limitations and workarounds

To simplify the tag processing API, JSP 2.0 adopted a limit: If the custom tag processing class is based on the simple tag API, then the page author and shall not be used between the JSP 1.x statement (), JSP 1.x expression ( ) and scriptlet (). In most cases, you can Java code in JSP page to move to tag handling class, or in JSP 2.0 Expression (${...})( can use the custom tag's body) to use JSTL. Please note, JSP 2.0 allows you to standards-based API for custom tag to use the body tag scriptlet. However, because the script does not use JSP pages easier to maintain, it is best to avoid the use of Java in the Web page code.

My previous Oracle Technology Network (OTN) article, "Using JSP 2.0 EL API" describes a simple tag API, and provides another limit workaround. JspContext class is not available on the JSP implicit objects (such as application, session, request and response) of the visit. Most application servers (including Oracle Application Server Containers for J2EE (OC4J) 10g) allows to convert the JSP PageContext context

Tag handler does not apply to the use println () statement generates a large number of reusable HTML code. JSP 2.0 this work provides a better way. JSP tag files to use the so-called by the JSP container syntax is automatically converted to a simple tag on the tag handler API. Another one of my OTN article "Creating JSP 2.0 tag files", introduced new features to this JSP.

Export variable tag

Many JSTL tags to achieve a logical and export JSP variable to report the results. For example, contains a var attribute must specify the SQL result set to save the JSP variable name. var property on the other JSTL tags (such as and) is optional. If the var attribute does not exist, then these tags will output their results. Var properties all contain the tags also contain a scope attribute that can be used to indicate the following JSP variable scope: page, request, session or application.

VarTagSupport class (which is an example of this development) Extension SimpleTagSupport var and scope attributes for the provision of setting method. VarTagSupport contains export JSP variables, access to the main content and practical method of output, rather than to achieve doTag () method. These methods from the sub-class VarTagSupport doTag () to use. This article includes four tag for the expansion VarTagSupport handling class (EvalTag, MapTag, ListTag and ItemTag).

Please note, JSP variable in JSTL specification called the scope of variables in the JSP specification, called the scope of named variables or attributes. These variables JspContext class by setAttribute () method to create / export. You can use the JSP page $ (varName), and the use of Java code JspContext the getAttribute () or findAttribute () method to obtain their values. Do not confuse the JSP tag variables and attributes.







相关链接:



Easy Graphic



ASF to AVI



Symantec said the new storm worm detected



"Chino conflict" Comment



DV to AVI



LIVEMOTION make the drop-down menu



MP4 to FLV



2007 College Graduates in Beijing reached 200 000



Restore usb flash drive



Cisco Crusade battle with Hewlett-Packard launched in China



PIMS And Calendars Infomation



DESKTOP Directory



Trust By The Bank Through The East, TongLINK / Q Acclaimed



Easy E-Mail Clients



Summer Cold! Photoshop To Add Some Ice Cup



Sogou Pinyin input method and How to do conflict game?



Monday, October 18, 2010

Dell is holding a 10 billion U.S. dollars in cash ready to deal



October 23, according to foreign media reports, Dell CEO Michael Dell (Michael Dell) Wednesday said it would use cash on hand for acquisitions.

Michael said the slowdown in demand as customers, Dell will re-adjust their business to enhance market competitiveness. At the same time, Dell will make use of their cash to make acquisitions and invest in infrastructure. According to Michael disclosed that Dell now has 100 million in cash and investments.

In addition, Michael also said the 8,900 job cuts previously announced plan has been completed. Dell in August announced the completion of 8,500 job cuts. Dell is currently no new layoff plans.







Recommended links:



RMVB to MP4



Pchnotify Exe Has Encountered A Problem Try



MKV to FLV



brief Genealogy



AUTOMATION is everywhere



CIMS Help Dragon Fly



Sohu Sina Hero Beyond The Seating Rearrangement



Easy to use Adventure And ROLEPLAY



Custom FTP enjoy the thrill OF speed of downloads



TS to MPG



Shop Languages Education



Spring Scene Photos Using Photoshop Will Be Processed Into Autumn Scenery



Beijing-Shenyang Expressway: Breaking the "separatism," the FIRST



Expert Backup And Restore



HTML 5 to replace Flash?



Saturday, October 9, 2010

PS7.0 landscape plan to add a rain effect


2. Light rain pattering

In fact, the operation to achieve the pattering rain and snow in the process to achieve essentially the same, but the details of the changes in the middle or a little before the "snow" to "Rain."

Effect diagram is as follows:



1. We just open the photograph of landscape material map, also the implementation of copy "layer copy" of the operation, such a simple question Needless to say instead.

2. Sure to select the "Background copy" layer, then the same ibid case of the implementation of "filter - pixel of - dot" of filter operation, a "dot" of the dialog box shown in Figure 9, the unit fill cell size 3, this value determines the size of raindrops.



Figure 9



Figure 10 (after the dot of the image filter effects)

3. Now we get the results in Figure 10 there is still a point as the snow flakes were the following, we not only want to slice into granules, but also the color of them removed. Implementation of the "Image - Adjustment - Threshold" operation, open the "threshold" dialog box will set the maximum threshold value of 255 Levels, Figure 11:



Figure 11



Figure 12 (after the implementation of the image threshold operation results)




[Next]



4. In the "Layers" panel will be "layer copy of the" mixed layer layer mode set to "color filter" copy layer "rain" effect into the background layer up, the effect shown in Figure 13:



Figure 13

5. Like rain and snow have dynamic characteristics, we implement "filter - Fuzzy - Motion Blur" in the "Motion Blur" box will be set from 18, the angle set to 75 degrees, shown in Figure 14. Thus, our results basically completed the rain, the effect shown in Figure 15.



Figure 14



Figure 15

6. But careful friend must have found that rain does not seem so vague it! Now we let the rain clear up, click on "Filter - Sharpen-USM sharpening" appears "USM Sharpening" box, adjust the "quantity" block plan to adjust the size of the extent of the rain. In this case the specific settings to Figure 16.



Figure 16

7. Thus, our results also rained out, the final results shown in Figure 17:



Figure 17






Recommended links:



YUV To AVI



Introduction Games Simulation



Open-source third-polar world



Compare ANTI-VIRUS Tools



3G Competition: adjust rates really can "cure"?



Acer said that no layoffs after the merger of Gateway



Top Personal Finance



Perfect Songs I Enjoy The Cool Music Box Full Support Win7



MPEG TO MOV



Anycool T518 Quad Band Tv Cellphone With Dual



DV to AVI



Photoshop Production - wire and spark



Directory Graphic CAD



Looking for a breakthrough signing strangers



Photoshop Swiss cheese food series