HTML and CSS Reference
In-Depth Information
Listing 10-3 shows the code of the BaseBacking class.
Listing 10-3. BaseBacking Bean Class
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
public class BaseBacking {
protected FacesContext getContext() {
return FacesContext.getCurrentInstance();
protected Map getRequestMap() {
return getContext().getExternalContext().getRequestMap();
protected HttpSession getSession() {
return (HttpSession) getContext().getExternalContext().getSession(false);
protected Object evaluateEL(String elExpression, Class beanClazz) {
return getContext().getApplication().evaluateExpressionGet(getContext(), elExpression,
BaseBacking class is a base class which contains shortcuts for getting the JSF Faces context, getting the HTTP
session, getting the HTTP request map, and evaluating the JSF expressions. Listing 10-4 shows the weather.xhtml
page code.
Listing 10-4. Weather Main Page
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns=" "
xmlns:ui=" "
xmlns:h=" "
xmlns:mashup=" " >
<ui:composition template="/WEB-INF/templates/main.xhtml">
<ui:define name="title">
Search WWH ::

Custom Search