com.bea.netuix.servlets.controls.content.backing
Interface JspBacking

All Superinterfaces
Serializable
All Known Implementing Classes:
AbstractJspBacking

public interface JspBacking
extends Serializable

This interface specifies a backing file. A backing file is a simple Java class implementing this interface that has been wired to a portal element in the .portal file. Backing files work in conjunction with JSPs. The JSPs allow the developer to code the presentation logic, while the backing files allows the developer to code simple business logic. Backing files are always run before the JSPs. A backing file has a lifecycle with four methods (see below). These methods are run 'in order' on all objects. The developer may affect the underlying object from the BackingContext. The BackingContext should be used from the backing file and the PresentationContext should be used from the JSPs.

Alternately the developer can extend the AbstractJspBacking file instead of implementing this interface.

Typically a new instance of this class (backing file) is created per request and is not shared across books/pages/portlets. If, however, 'threadsafe' is marked as true on the JspContent control a shared instance will be used. This instance is shared even across multiple requests. A slight performance boost can be gained by setting the 'threadsafe' attribute to true as a new instance need not be created per each request. However, any instance variables will need to be synchronized if not threadsafe. It is also recommended to use this setting with caution when your backing file is registered to receive portlet events.

See Also
AbstractJspBacking, BackingContext, PortletBackingContext, BookBackingContext, PageBackingContext

Method Summary
 void dispose()
          This method is called at the end of serving the request, after the JSP has rendered.
 boolean handlePostbackData(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          The purpose of this method is to let an implementation process request data.
 void init(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is called once per request, and backing files can do request-scoped initialization by implementing this method.
 boolean preRender(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          This method is called before rendering the JSP that this backing file is associated with.
 

Method Detail

init

void init(javax.servlet.http.HttpServletRequest request,
          javax.servlet.http.HttpServletResponse response)

This method is called once per request, and backing files can do request-scoped initialization by implementing this method. This method is run on the window (book/page/portlet) even if the window is not currently on a selected page.

Parameters
request - HTTP request
response - HTTP response

handlePostbackData

boolean handlePostbackData(javax.servlet.http.HttpServletRequest request,
                           javax.servlet.http.HttpServletResponse response)

The purpose of this method is to let an implementation process request data.

This method should return true if it changes the window mode, window state, or the current page. If the method returns true, any caches are invalidated, and event processing is run on this control.

Parameters
request - HTTP request
response - HTTP response
Returns
boolean true if the window mode, state, or current page were changed

preRender

boolean preRender(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)

This method is called before rendering the JSP that this backing file is associated with. This method will not be run if the book/page/portlet is not being rendered (displayed). This is useful if heavy business logic only needs to be run if this portlet is on a selected page.

This method should return true to let the framework render the JSP. If this method returns false, the framework will not render the content JSP.

Note: if you don't want the Window (book, page or portlet) to render at all, call setVisible(false) on the backing context.

Parameters
request - HTTP request
response - HTTP response
Returns
boolean true if the content JSP should be rendered.
See Also
BackingContext, PortletBackingContext, BookBackingContext, PageBackingContext

dispose

void dispose()

This method is called at the end of serving the request, after the JSP has rendered.



Copyright © 2011, Oracle. All rights reserved.