2. Using the Tutorial Examples 3. Getting Started with Web Applications 5. JavaServer Pages Technology Using Objects within JSP Pages Using Application-Specific Objects Immediate and Deferred Evaluation Syntax Deactivating Expression Evaluation Process of Expression Evaluation JavaBeans Component Design Conventions Creating and Using a JavaBeans Component Setting JavaBeans Component Properties Retrieving JavaBeans Component Properties Including the Tag Library Implementation Transferring Control to Another Web Component Further Information about JavaServer Pages Technology 7. JavaServer Pages Standard Tag Library 10. JavaServer Faces Technology 11. Using JavaServer Faces Technology in JSP Pages 12. Developing with JavaServer Faces Technology 13. Creating Custom UI Components 14. Configuring JavaServer Faces Applications 15. Internationalizing and Localizing Web Applications 16. Building Web Services with JAX-WS 17. Binding between XML Schema and Java Classes 19. SOAP with Attachments API for Java 21. Getting Started with Enterprise Beans 23. A Message-Driven Bean Example 24. Introduction to the Java Persistence API 25. Persistence in the Web Tier 26. Persistence in the EJB Tier 27. The Java Persistence Query Language 28. Introduction to Security in the Java EE Platform 29. Securing Java EE Applications 31. The Java Message Service API 32. Java EE Examples Using the JMS API 36. The Coffee Break Application | Setting Properties for Groups of JSP PagesIt is possible to specify certain properties for a group of JSP pages:
A JSP property group is defined by naming the group and specifying oneor more URL patterns; all the properties in the group apply to theresources that match any of the URL patterns. If a resource matches URLpatterns in more than one group, the pattern that is most specific applies. To define a property group in a deployment descriptor using NetBeans IDE, followthese steps:
Instead of performing the preceding steps, you can define a JSP property groupby editing the XML by hand using NetBeans IDE by doing thefollowing:
The following sections discuss the properties and explain how they are interpreted forvarious combinations of group properties, individual page directives, and web application deployment descriptorversions. Deactivating EL Expression EvaluationEach JSP page has a default mode for EL expression evaluation. The defaultvalue varies depending on the version of the web application deployment descriptor. Thedefault mode for JSP pages delivered with a Servlet 2.4 descriptor is toevaluate EL expressions; this automatically provides the default that most applications want. Thedefault mode for JSP pages delivered using a descriptor from Servlet 2.3 orbefore is to ignore EL expressions; this provides backward compatibility. For tag files (seeEncapsulating Reusable Content Using Tag Files), the default is to always evaluate expressions. You can override the default mode through theisELIgnored attribute of thepage directive in JSP pages and through theisELIgnored attribute of thetagdirective in tag files. You can also explicitly change the default mode bydoing one of the following:
Table 5-8 summarizes the EL evaluation settings for JSP pages. Table 5-8 EL Evaluation Settings for JSP Pages
Table 5-9 summarizes the EL evaluation settings for tag files. Table 5-9 EL Evaluation Settings for Tag Files
Declaring Page EncodingsYou set the page encoding of a group of JSP pages using theJSP property group configuration in the deployment descriptor by doing one of thefollowing:
A translation-time error results if you define the page encoding of a JSPpage with one value in the JSP configuration element and then giveit a different value in apageEncoding directive. Defining Implicit IncludesYou can implicitly include preludes and codas for a group of JSP pagesby adding items to the Include Preludes and Codas lists. Their values arecontext-relative paths that must correspond to elements in the web application. When theelements are present, the given paths are automatically included (as in anincludedirective) at the beginning and end, respectively, of each JSP page in theproperty group. When there is more than one include or coda element ina group, they are included in the order they appear. When more thanone JSP property group applies to a JSP page, the corresponding elements willbe processed in the same order as they appear in the JSP configurationsection. For example, the Duke’s Bookstore application uses the files/template/prelude.jspf and/template/coda.jspfto include the banner and other boilerplate in each screen. To add thesefiles to the Duke’s Bookstore property group using the deployment descriptor, follow these steps:
Instead of performing the preceding steps, you can add preludes and codas byediting the XML by hand using NetBeans IDE by doing the following:
Preludes and codas can put the included code only at the beginningand end of each file. For a more flexible approach to building pagesout of content chunks, seeA Template Tag Library. Eliminating Extra White SpaceWhite space included in the template text of JSP pages is preserved bydefault. This can have undesirable effects. For example, a carriage return added afterataglib directive would be added to the response output as an extraline. If you want to eliminate the extra white space from the page,you can add atrim-directive-whitespaces element to ajsp-property-group element in the deploymentdescriptor and set it totrue. To set thetrim-directive-whitespaces element to true using NetBeans 5.5, do the following:
Alternatively, a page author can set the value of thetrimDirectiveWhitespaces attributeof thepage directive to true or false. This will override the valuespecified in the deployment descriptor. Custom tag authors can eliminate white space from the output generated by atag file by setting thetrimDirectiveWhiteSpace attribute of thetag directive to true. Copyright © 2010, Oracle and/or its affiliates. All rights reserved.Legal Notices |