Simple rich:panel
arun.b May 28, 2012 8:03 AMHi All,
I am new to JSF and Richfaces, and I am trying the sample below. When I use template, the page is working fine (CSS and JS are being added). But when I directly write the rich:panel inside the ui:composition (without ui:define) as mentioned below, CSS and JS are not being added to the page output. Can someone help me in understanding the mistake I did when not using template?
With template:
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head> <title>Facelet Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </h:head> <h:body> <ui:composition xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich" template="templates/template.xhtml"> <ui:define name="body"> <rich:panel header="Panel with default Look-n-feel"> Each component in RichFaces has a pre-defined set of CSS classes you can manipulate. If defined, those classes overwrite the ones that come from the skin. </rich:panel> </ui:define> </ui:composition> </h:body> </html>
template:
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"> <h:head> <title>RichFaces Application</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </h:head> <h:body> <ui:insert name="body">Default content</ui:insert> </h:body> </html>
Without template: (CSS and JS are not being sent in the response)
<?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http://java.sun.com/jsf/core" xmlns:a4j="http://richfaces.org/a4j" xmlns:rich="http://richfaces.org/rich"> <h:head> <title>Facelet Title</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> </h:head> <h:body> <ui:composition> <rich:panel header="Panel with default Look-n-feel"> Each component in RichFaces has a pre-defined set of CSS classes you can manipulate. If defined, those classes overwrite the ones that come from the skin. </rich:panel> </ui:composition> </h:body> </html>
Thanks in advance.