RichFaces-Fast-JSF

From Resin 3.0

Revision as of 17:16, 26 June 2008 by Alex (Talk | contribs)
Jump to: navigation, search

Contents

Running RichFaces and Ajax4JSF applications in fast-jsf mode

Fast JSF

Resin allows running your JSF applications in fast jsf mode. Fast JSF mode is applied to JSP code generator making it bypass JSP tags and use the component classes directly to construct component tree defined in the JSP flie. To enable fast JSF mode for a particular library Resin needs to know which components the tags bind to. E.g. in a standard JSF library a h:message component would bind to javax.faces.component.html.HtmlMessage and Resin knows it from the following binding included in Resin's distribution.

<jsf-taglib xmlns="http://caucho.com/ns/resin">
  <uri>http://java.sun.com/jsf/html</uri>
   ...
  <jsf-tag>
    <name>messages</name>
    <component-class>javax.faces.component.html.HtmlMessages</component-class>
  </jsf-tag>
  ...
</jsf-tablib>

For RichFaces two bindings needed: one for the base Ajax4JSF library and another for RichFaces UI.

Ajax4JSF

<?xml version='1.0'?>
<jsf-taglib xmlns='http://caucho.com/ns/resin'>
	<uri>http://richfaces.org/a4j</uri>
	<jsf-tag>
		<name>actionparam</name>
		<component-class>org.ajax4jsf.component.html.HtmlActionParameter</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>commandButton</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxCommandButton</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>commandLink</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxCommandLink</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>form</name>
		<component-class>org.ajax4jsf.component.html.AjaxForm</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>include</name>
		<component-class>org.ajax4jsf.component.html.Include</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>jsFunction</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxFunction</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>loadBundle</name>
		<component-class>org.ajax4jsf.component.html.AjaxLoadBundle</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>loadScript</name>
		<component-class>org.ajax4jsf.component.html.HtmlLoadScript</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>loadStyle</name>
		<component-class>org.ajax4jsf.component.html.HtmlLoadStyle</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>log</name>
		<component-class>org.ajax4jsf.component.html.AjaxLog</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>mediaOutput</name>
		<component-class>org.ajax4jsf.component.html.MediaOutput</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>outputPanel</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxOutputPanel</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>page</name>
		<component-class>org.ajax4jsf.component.html.HtmlPage</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>poll</name>
		<component-class>org.ajax4jsf.component.html.AjaxPoll</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>portlet</name>
		<component-class>org.ajax4jsf.component.html.HtmlPortlet</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>push</name>
		<component-class>org.ajax4jsf.component.html.AjaxPush</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>region</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxRegion</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>repeat</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxRepeat</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>status</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxStatus</component-class>
	</jsf-tag>
	<jsf-tag>
		<name>support</name>
		<component-class>org.ajax4jsf.component.html.HtmlAjaxSupport</component-class>
	</jsf-tag>
</jsf-taglib>
</pre</code>

=== Switching the Fast JSF mode on and off ===
Fast JSF mode can be turned on globally or for particular context by setting ''fast-jsf'' flag to ''true'' in ''$RESIN-HOME/conf/resin.xml'' or ''my-app/WEB-INF/resin-web.xml''. In Resin 3.2 fast-jsf mode is turned on by default.

Example of ''$my-app/WEB-INF/resin-web.xml'' that turns fast JSF mode on

<code><pre>
<web-app xmlns='http://caucho.com/ns/resin'>
  <jsf fast-jsf='true'/>
</web-app>

=

Ajax4JSF

RichFaces

Personal tools