Transferring Control to Another Web Component (original) (raw)
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
Setting Properties for Groups of JSP Pages
Deactivating EL Expression Evaluation
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
37. The Duke's Bank Application
Transferring Control to Another Web Component
The mechanism for transferring control to another web component from a JSP page uses the functionality provided by the Java Servlet API as described in Accessing a Session. You access this functionality from a JSP page by using the jsp:forward element:
<jsp:forward page="/main.jsp" />
Note that if any data has already been returned to a client, the jsp:forward element will fail with an IllegalStateException.
jsp:param Element
When an include or forward element is invoked, the original request object is provided to the target page. If you wish to provide additional data to that page, you can append parameters to the request object by using thejsp:param element:
<jsp:include page="..." > <jsp:param name="param1" value="value1"/>
When jsp:include or jsp:forward is executed, the included page or forwarded page will see the original request object, with the original parameters augmented with the new parameters and new values taking precedence over existing values when applicable. For example, if the request has a parameter A=foo and a parameter A=bar is specified for forward, the forwarded request will have A=bar,foo. Note that the new parameter has precedence.
The scope of the new parameters is the jsp:include or jsp:forward call; that is, in the case of an jsp:include the new parameters (and values) will not apply after the include.
Copyright © 2010, Oracle and/or its affiliates. All rights reserved. Legal Notices