You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by Apache Wiki <wi...@apache.org> on 2007/11/06 00:07:52 UTC

[Myfaces Wiki] Update of "Execute action on page load" by AndrewRobinson

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by AndrewRobinson:
http://wiki.apache.org:80/myfaces/Execute_action_on_page_load

The comment on the change is:
Creation

New page:
A very FAQ is people that want to be able to run code -- or more specifically actions -- on the loading of a JSF page. 

There is nothing built into JSF that allows one to do this, but the framework allows something to be built. Three projects are already implement that give this functionality. They are:

 1. [http://jsf-comp.sourceforge.net/components/onload/index.html jsf-comp on-load] - Simple component with little dependencies
 2. [http://docs.jboss.org/seam/1.2.1.GA/reference/en/html/events.html#d0e3776 JBoss Seam] - Robust EJB3 targeted JSF framework from JBoss
 3. [http://shale.apache.org/shale-view/index.html Shale View Controller] - Medium weight JSF framework

= JSF Comp =

The [http://jsf-comp.sourceforge.net/components/onload/index.html jsf-comp on-load] is your best bet if you want a light-weight solution. It comes with no baggage. It uses standard JSF navigation rules based one outcomes and leverages XML configuration files to specify which actions to run based on which pages.

{{{Note: If you are using JBoss Seam you cannot use it though due to Seam configuration.}}}

= JBoss Seam =

The [http://docs.jboss.org/seam/1.2.1.GA/reference/en/html/events.html#d0e3776 JBoss Seam] library uses pages.xml to configure what actions to run when a page is loaded. It is very similar in implementation to JSF-comp's project. It also comes with a lot of other JSF functionality that you may find interesting.

= Shale =

The [http://shale.apache.org/shale-view/index.html Shale View Controller] is not as heavy as JBoss Seam, but is still much heavier than jsf-comp's on-load. Unlike the other two, it uses Java class naming conventions to bind java code to a page view. Due to this reason, you cannot use the same code for two pages without a bit of tweaking. It also does not support JSF navigation rules, you have to hand code this in the handling bean if you want to navigate to a new page. It does provide functionality beyond just an "on-load" though.