Monday, July 7, 2008

Backing File

Backing files allow you to programatically add functionality to a portlet by implementing a Java class, which enables preprocessing prior to rendering the portal controls. It can be attached to portals either by using WebLogic Workshop or coding them directly into a .portlet file.

It's simple Java classes that implement the com.bea.netuix.sevlets.controls.content.backing.JspBacking interface or extend the com bea.netuix.servlets.controls.content.backing.AbstractJspBacking abstract class.

This Backing File supports the following control

Desktops
Books
Pages
Portlets

All backing files are executed before and after the JSP is called.Each Backing files are call the following methods.

init()
handlePostBackData()
raiseChangeEvents()
preRender()
dispose()

Example :

package backing;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.bea.netuix.events.Event;
import com.bea.netuix.events.CustomEvent;
import com.bea.netuix.servlets.controls.content.backing.AbstractJspBacking;
public class cashierEntry extends AbstractJspBacking{
public void getcashierEntryDetails ( HttpServletRequest request, HttpServletResponse response, Event event){
CustomEvent customEvent = (CustomEvent) event;
String message = (String) customEvent.getPayload();
HttpSession mySession = request.getSession();
mySession.setAttribute("customerName", message);
}
}

Once you create the backing file set the same to portlet/Page/Book by property.



Otherwise you can directly add the backing file with the .portlet file.


contentUri="/com/SBIlife/portlets/ss/homeEntry.jsp"/>


Using this Backing file ,you can effectily do the validation for portlet/Book/Page.

No comments: