You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2014/01/28 02:49:12 UTC

svn commit: r1561922 [4/5] - in /myfaces/site/cms-site/trunk/content/wiki: ./ asf-board-reports/ commons/ commons/user-guide/ core/ core/committer-and-pmc-guide/ core/committer-and-pmc-guide/myfaces-project-management/ core/user-guide/ core/user-guide/...

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/displaying-errors---infos---warnings-in-jsf-pages.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/displaying-errors---infos---warnings-in-jsf-pages.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/displaying-errors---infos---warnings-in-jsf-pages.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/displaying-errors---infos---warnings-in-jsf-pages.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,271 @@
+Title: Displaying Errors - Infos - Warnings in JSF pages
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+<p>One common question about JSF is how to manage messages of various
+types, which are generated by JSF components and backing beans. This
+discussion is designed as an introduction to the topic and focused on entry
+to mid-level JSF users.</p>
+
+<p>The pattern described here is just one approach that we developed which
+meets our needs for:</p>
+
+<ol>
+	<li>Providing a consistent and generic means for including
+processing messages in all JSF pages.</li>
+	<li>Decorating the messages with images and styles to differentiate
+severity levels to the user which is browser safe.</li>
+	<li>Add additional messages when appropriate.</li>
+	<li>Be localizable.</li>
+	<li>Not affect page layouts when no errors are generated.</li>
+</ol>
+
+
+<h3>Discussion</h3>
+
+<p>Our user-interface requirements dictate that (a) as far as the user is
+concerned there is no such thing as an error, (b) the system should provide
+as little information as necessary to draw the user's attention to any
+issues raised during processing and help them correct the problem, (c)
+inform on all operations which change state in the back-end (success as
+well as failure), and (d) provide a way out (i.e. graceful means for
+backing out of any failed operation).</p>
+
+<p>While (a) and (d) require detailed discussion on overall system design
+which is out of scope of this topic, (b) and (c) are certainly within the
+purview of this JSF discussion and are our points of focus.</p>
+
+<h3>JSF message components</h3>
+
+<p>The basic mechanism for managing page-specific messages is to include
+<code>&lt;h:message&gt;</code> and <code>&lt;h:messages&gt;</code> tags in
+the JSF page. &lt;h:message&gt; is component specific (i.e. tied to a
+particular JSF component ID) while &lt;h:messages&gt; can provide global
+messaging as well as roll-up all component specific messages. Our
+experience is that <code>&lt;h:message&gt;</code> is useful for components
+which have validation but the <code>&lt;h:messages&gt;</code> tag needs to
+be better managed to control layout and information-provision. For example,
+rather than displaying a list of validation errors that have been generated
+we would like to provide a new message such as 'One or more fields have
+missing or invalid values. Please re-check the fields indicated below and
+re-submit the form.'</p>
+
+<p>JSF message tags display messages which have been queued as the request
+is processed. Each message that is queued has a message priority which is
+one of the FacesMessage priorities defined in
+javax.faces.application.FacesMessage and are defined as</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+    public static final FacesMessage.Severity SEVERITY_INFO = new
+Severity("Info", 1);
+    public static final FacesMessage.Severity SEVERITY_WARN = new
+Severity("Warn", 2);
+    public static final FacesMessage.Severity SEVERITY_ERROR = new
+Severity("Error", 3);
+    public static final FacesMessage.Severity SEVERITY_FATAL = new
+Severity("Fatal", 4);
+]
+]></ac:plain-text-body></ac:macro>
+<p>and can be either associated with a component or not. When a message is
+generated during processing, the component, validator or backing generating
+the message palces the message into one of the message queues where it can
+be accessed by the JSF during the rendering phase.</p>
+
+<h3>Generating Messages</h3>
+
+<p>Messages (error/info/warn/fatal) can be enqueued by calling the
+FacesContext.getCurrentInstance().addMessage() method. Our requirements
+state that messages are displayed on all change in state as well as
+processing errors such as bad databases retrievals etc. which means that
+the majority of our pages need to be able to generate messages. To this
+end, we found it is convienient to put quick-access methods in a base class
+and sub-class all backing beans from it. This is similar to how Sun
+Creator's 1.0 manages backing beans and our methods are adopted from this.
+For severity our base class has two methods as below for INFO.</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+   protected void setInfoMessage(String summary) {
+
+	getFacesContext().addMessage(null, new
+FacesMessage(FacesMessage.SEVERITY_INFO, summary, null));
+
+    }
+
+
+
+    protected void setInfoMessage(UIComponent component, String summary) {
+
+       
+getFacesContext().addMessage(component.getClientId(getFacesContext()), new
+FacesMessage(FacesMessage.SEVERITY_INFO, summary, null));
+
+    }
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>The first method enqueues a global message with INFO severity while the
+second method associates the INFO message with a component (most probably
+from a custom (page-specific) validation. We also have a base class for all
+our validators (which perform page-specific validation when necessary)
+which uses the following protected method for raising messages</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+    protected static void invalidateInput(UIInput uii, String message) {
+
+	uii.setValid(false);
+
+	FacesMessage facesMessage = new
+FacesMessage(FacesMessage.SEVERITY_WARN, message, null);
+
+	throw new ValidatorException(facesMessage);
+
+    }
+
+]
+]></ac:plain-text-body></ac:macro>
+<p>Note that we only raise messages with WARN severity as our requirements
+preclude displaying anything which looks or smells like an error to our
+users.	</p>
+
+<p>As all our backing beans have these methods accesible to them, we can
+simply add appropriate calls to enqueue messages in our business logic such
+as</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+	    setInfoMessage(Messages.getString("MANIFEST_SAVED"));
+
+or
+
+	    setWarnMessage(Messages.getString("UPDATE_DATABASE_ERROR"));
+
+or
+
+	    setInfoMessage(Messages.getString("STORAGE_TRANSFER_ONE", new
+Integer(count), fromUnit.getName(), toUnit.getName()));
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>where the Messages class provides access to a messages properties file
+and performs standard parameter replacement using Apache's Common Lang
+StringUtils.</p>
+
+<h3>Displaying Messages</h3>
+
+<p>Rasing messages is one topic, displaying them another. As we need a
+consistent look and feel for all messages we choose to include a JSP in
+each page which handles all messages which are not component specific. Our
+PageMessages.jspf is as follows:</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+
+<h:panelGrid styleClass="group" columns="2" cellpadding="2" cellspacing="0"
+width="100%" columnClasses="buttonCol, leftAlignCol"
+rowClasses="vertAlignTop" rendered="#{! empty
+facesContext.maximumSeverity}" >
+	<h:graphicImage value="#{PageMessages.messageImage}" style="float:
+left; vertical-align: top;" />	     
+	<h:panelGrid columns="1" cellpadding="2" cellspacing="2"
+columnClasses="leftAlignCol" rowClasses="vertAlignTop" width="100%">   
+	    <h:outputText value="#{PageMessages.messageHeader}"
+escape="false" rendered="#{PageMessages.renderMessage}"/>
+	    <h:messages errorClass="errorMessage" infoClass="infoMessage"
+layout="table" globalOnly="true" showDetail="false" showSummary="true"/>
+	</h:panelGrid>
+</h:panelGrid>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>The messages are only displayed only if one or more messages are
+enqueued by conditionally rendering the table using
+<code>rendered=&quot;#{! empty facesContext.maximumSeverity}&quot;</code>
+which uses EL to check if the queues are empty or not. Depending on the
+level of severity we display an themed image followed by an optional
+pre-amble to the messages and then the global messages themselves. The
+global messages are displayed in table format.</p>
+
+<p>You will notice that we use a backing bean (PageMessages.java) in <span
+style="text-decoration: underline;">request scope</span> to control the
+JSPF. The code for this is as follows:</p>
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">PageMessages.java</ac:parameter><ac:plain-text-body><![CDATA[
+import Messages;
+
+import org.apache.commons.lang.StringUtils;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.application.FacesMessage.Severity;
+
+
+public class PageMessages extends AbstractUIBean {
+    private static final long serialVersionUID = -6479897299239746841L;
+    private static final String BEAN_NAME = PageMessages.class.getName();
+    private String messageHeader;
+    private String messageImage;
+    private Severity severityLevel;
+
+    public PageMessages() {
+	messageHeader = null;
+
+	// See if there are messages queued for the page
+	severityLevel = getFacesContext().getMaximumSeverity();
+
+	if (null != severityLevel) {
+	    getLogger().debug("Severity Level Trapped: level = '" +
+severityLevel.toString() + "'");
+
+	    if (severityLevel.equals(FacesMessage.SEVERITY_ERROR)) {
+		messageHeader = Messages.getString("PAGE_MESSAGE_ERROR");
+		messageImage = "resources/warning.gif";
+	    } else if (severityLevel.equals(FacesMessage.SEVERITY_INFO)) {
+		messageHeader = null;
+		messageImage = "resources/information.gif";
+	    } else if (severityLevel.equals(FacesMessage.SEVERITY_WARN)) {
+		messageHeader = null;
+		messageImage = "resources/warning.gif";
+	    } else if (severityLevel.equals(FacesMessage.SEVERITY_FATAL)) {
+		messageHeader = Messages.getString("PAGE_FATAL_ERROR");
+		messageImage = "resources/stop.gif";
+	    }
+	} else {
+	    getLogger().debug("Severity Level Trapped: level = 'null'");
+	}
+    }
+
+    public Boolean getRenderMessage() {
+	return new Boolean(StringUtils.isNotBlank(getMessageHeader()));
+    }
+
+    public String getBeanName() {
+	return BEAN_NAME;
+    }
+
+    public String getMessageHeader() {
+	return messageHeader;
+    }
+
+    public String getMessageImage() {
+	return messageImage;
+    }
+}
+]
+]></ac:plain-text-body></ac:macro>
+<p>Our backing bean extends our basic UI base classes which provides access
+to central logging etc. You can see that if a component has enqueued a
+message of ERROR we add a localized message at the top of the page which
+(we hope) gracefully moderates the user-impact of seeing the same form
+again with a bunch of annotations!</p>
+
+<p>The PageMessages.jspf is included into each JSP using the following
+code:</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<f:subview id="messages">
+    <jsp:directive.include file="PageMessages.jspf" />
+</f:subview>
+]
+]></ac:plain-text-body></ac:macro>
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/handling-server-errors.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/handling-server-errors.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/handling-server-errors.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/handling-server-errors.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,613 @@
+Title: Handling Server Errors
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+<h2>Error handling for MyFaces Core 2.0 and later versions</h2>
+
+<p>Since JSF 2.0, it is possible to provide a custom
+javax.faces.context.ExceptionHandler or
+javax.faces.context.ExceptionHandlerWrapper implementation to deal with
+exceptions. To do that, just create your custom class, an factory that
+wrap/override it and add the following into your faces-config.xml:</p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">faces-config.xml</ac:parameter><ac:plain-text-body><![CDATA[
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd" 
+	      version="2.0">
+
+    <!-- ... -->
+    <factory>
+	<!-- ... -->
+       
+<exception-handler-factory>org.apache.myfaces.context.ExceptionHandlerFactoryImpl</exception-handler-factory>
+	<!-- ... -->
+    </factory>
+    <!-- ... -->
+</faces-config>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>This is an example of an ExceptionHandlerFactory, from myfaces code:</p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">ExceptionHandlerFactoryImpl.java</ac:parameter><ac:plain-text-body><![CDATA[
+public class ExceptionHandlerFactoryImpl extends ExceptionHandlerFactory
+{
+
+    @Override
+    public ExceptionHandler getExceptionHandler()
+    {
+	return new SwitchAjaxExceptionHandlerWrapperImpl(
+		new MyFacesExceptionHandlerWrapperImpl(new
+ExceptionHandlerImpl()) , 
+		new AjaxExceptionHandlerImpl());
+    }
+}
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>If you need a wrapper:</p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">ExceptionHandlerFactoryImpl.java</ac:parameter><ac:plain-text-body><![CDATA[
+public class ExceptionHandlerFactoryImpl extends ExceptionHandlerFactory
+{
+
+    @Override
+    public ExceptionHandler getExceptionHandler()
+    {
+	return new
+CustomExceptionHandlerWrapper(getWrapped().getExceptionHandler());
+    }
+}
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>The most important method to override is
+<code>ExceptionHandler.handle()</code>. </p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">MyFacesExceptionHandlerWrapperImpl.java</ac:parameter><ac:plain-text-body><![CDATA[
+public class MyFacesExceptionHandlerWrapperImpl extends
+ExceptionHandlerWrapper
+{
+    //...
+    public void handle() throws FacesException
+    {
+       //... some custom code goes here ...
+    }
+}
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>Take a look at MyFaces Core source code, to know in detail how
+ExceptionHandler implementations works.</p>
+
+<h3>MyFaces ExceptionHandler</h3>
+
+<p>MyFaces Core provide a custom ExceptionHandler to deal with exceptions
+and provide detailed information about it. Since 2.0.8/2.1.2 this is
+disabled on Production environments unless it enabled on web.xml file.
+Don't forget to provide your custom error page in this scenario, to prevent
+show more information than necessary.</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
+    <param-value>true</param-value>
+  </context-param>
+
+  <!-- if you want to use a different resource template file than 
+       "META-INF/rsc/myfaces-dev-error.xml" this param let you configure
+       it. (since 1.2.4-SNAPSHOT and 1.1.6-SNAPSHOT)-->
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_TEMPLATE_RESOURCE</param-name>
+    <param-value>META-INF/rsc/custom-dev-error.xml</param-value>
+  </context-param>
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>Provide an error page</h3>
+
+<p>The default ExceptionHandler in Production stage or when myfaces error
+handling is disabled just throw an exception. So you can still setup an
+error page adding something like this in your web.xml file:</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<error-page>
+		<error-code>500</error-code>
+		<location>/somepage.jsp</location>
+	</error-page>
+]
+]></ac:plain-text-body></ac:macro>
+
+<h2>Error handling for MyFaces Core 1.2 and earlier versions</h2>
+
+<p>MyFaces, from version 1.2.1 and 1.1.6, includes automatic error-handling
+for the full JSF-Lifecycle (taken over mostly from Facelets, with a few
+adoptions and additions). So for most projects during development, you will
+have exactly what you want with these new error-handling possibilities.
+</p>
+
+<p>If this is not what you want, though, you can always disable or modify
+this error-handling with the following parameters:</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+  <!-- if you want to disable the behaviour completely -->
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
+    <param-value>false</param-value>
+  </context-param>
+  <!-- if you are using myfaces + facelets don't forget to do this -->
+  <context-param>
+    <param-name>facelets.DEVELOPMENT</param-name>
+    <param-value>false</param-value>
+  </context-param>
+
+  <!-- if you want to use a different resource template file than 
+       "META-INF/rsc/myfaces-dev-error.xml" this param let you configure
+       it. (since 1.2.4-SNAPSHOT and 1.1.6-SNAPSHOT)-->
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_TEMPLATE_RESOURCE</param-name>
+    <param-value>META-INF/rsc/custom-dev-error.xml</param-value>
+  </context-param>
+
+  <!-- if you want to choose a different class for handling the exception -
+the error-handler needs to include a method handleException(FacesContext
+fc, Exception ex)-->
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_HANDLER</param-name>
+    <param-value>my.project.ErrorHandler</param-value>
+  </context-param> 
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>If you do this, you can now read on to get to general ways of handling
+server-errors.</p>
+
+<p>Server errors such as HTTP 500 can occur for a number of reasons such as
+uncaught exceptions, missing JSFs or backing beans, bad URL and the list
+goes on. While we hope these only occur during development it is important
+to plan to catch and deal with these errors gracefully when running live
+with multiple users.</p>
+
+<p>Several approaches have been discussed on the mailing list:</p>
+
+<h3>Use default handler</h3>
+
+<p>Myfaces has a default error handler (class
+javax.faces.webapp._ErrorPageWriter) that uses a jsp template file
+(META-INF/rsc/myfaces-dev-error.xml and META-INF/rsc/myfaces-dev-debug.xml)
+to handle errors.</p>
+
+<p>For define a custom template file:</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_HANDLING</param-name>
+    <param-value>true</param-value>
+  </context-param>
+
+  <context-param>
+    <param-name>org.apache.myfaces.ERROR_TEMPLATE_RESOURCE</param-name>
+    <param-value>META-INF/rsc/mycustom-template-error.xml</param-value>
+  </context-param>
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>Use sandbox
+org.apache.myfaces.tomahawk.util.ErrorRedirectJSFPageHandler</h3>
+
+<p>This handler uses myfaces error handling feature, redirecting to a jsf
+page when an error occurs.</p>
+
+<p>An example jsf page for redirect can be found at <a
+class="external-link"
+href="http://issues.apache.org/jira/browse/TOMAHAWK-1297"
+rel="nofollow">http://issues.apache.org/jira/browse/TOMAHAWK-1297</a></p>
+
+<p>This class is set as a config-parameter
+org.apache.myfaces.ERROR_HANDLER<br />
+available on myfaces core jsf. (This does not work with RI)</p>
+
+<p>The idea is extends myfaces error handling feature, making possible to
+redirect<br />
+to a jsf page when an error occur, using navigation rules.</p>
+
+<p>If this handler is not able to handle the error, an alternate error
+handler<br />
+could be set in the config-parameter
+org.apache.myfaces.ERROR_REDIRECT_ALTERNATE_HANDLER</p>
+
+<p>The info of the error in the jsf page can be found using:</p>
+<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
+1. {exceptionContext.cause} : Cause retrieved from the exception
+1. {exceptionContext.stackTrace} : Stack trace of the exception
+1. {exceptionContext.exception} : Exception handled by this page 
+1. {exceptionContext.tree} : Print the component tree of the page that cause
+the error
+1. {exceptionContext.vars} : Enviroment variables from the request
+]
+]></ac:plain-text-body></ac:macro>
+
+
+<h3>Using servlets</h3>
+<p>Mert Caliskan (<a class="external-link"
+href="http://www.jroller.com/page/mert?entry=handling_errors_with_an_errror"
+rel="nofollow">http://www.jroller.com/page/mert?entry=handling_errors_with_an_errror</a>)
+describes an approach which wraps the JSF servlet with a new servlet which
+delegates to the faces servlet but handles uncaught exceptions allowing the
+developer to redirect to a custom error page.</p>
+
+<p>Andrea Paternesi has refined this technique for MyFaces as described
+here: <br />
+[<a href="http://patton-prog-tips.blogspot.com/2008/10/myfaces-handling-viewexpiredexception.html">http://patton-prog-tips.blogspot.com/2008/10/myfaces-handling-viewexpiredexception.html</a>](<a-href="http://patton-prog-tips.blogspot.com/2008/10/myfaces-handling-viewexpiredexception.html">http://patton-prog-tips.blogspot.com/2008/10/myfaces-handling-viewexpiredexception.html</a>.html)
+</p>
+
+<h3>With JSF</h3>
+<p>Another approach is described in the book 'Core Server Faces' which uses
+the servlet engine to catch the error and delegate to a JSF error page.
+While not as elegant as the  first approach this method has several
+advantages for some users</p>
+
+<p><ac:link><ri:page ri:content-title="1" /></ac:link> It uses a standard
+JSP approach and framework&lt;&lt;BR&gt;&gt;<br />
+<ac:link><ri:page ri:content-title="2" /></ac:link> It does not require
+custom servlets&lt;&lt;BR&gt;&gt;<br />
+<ac:link><ri:page ri:content-title="3" /></ac:link> It can easily be
+customized/changed by simply changing the error handler definition in the
+web.xml&lt;&lt;BR&gt;&gt;</p>
+
+
+<p>To implement this method perform the following steps</p>
+
+<p><ac:link><ri:page ri:content-title="1" /></ac:link> define an error
+handling web page in web.xml</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<error-page>
+		<error-code>500</error-code>
+		<location>/ErrorDisplay.jsf</location>
+	</error-page>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><ac:link><ri:page ri:content-title="2" /></ac:link> Create the error
+handler display. Due to a problem with the JSF 1.1 specification, the error
+handling page cannot use a &lt;f:view&gt; but must use a subview.</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<f:subview id="error"
+    xmlns:f="http://java.sun.com/jsf/core"
+    xmlns:t="http://myfaces.apache.org/tomahawk"
+    xmlns:h="http://java.sun.com/jsf/html">
+
+<html>
+<head>
+	<meta content="no-cache" http-equiv="Cache-Control" />
+	<meta content="no-cache" http-equiv="Pragma" />
+	<title>CMS - Error</title>
+	<t:stylesheet path="#{SessionBean.styleSheet}" />
+	</head>
+	<body>
+	<h:form>
+	   :
+	   : set up the normal view
+	   :
+	   <h:outputText styleClass="infoMessage" escape="false"
+value="#{ErrorDisplay.infoMessage}" />
+	   <t:htmlTag value="br" />
+	   <h:inputTextarea style="width: 99%;" rows="10" readonly="true"
+value="#{ErrorDisplay.stackTrace}" />
+	   :
+	   : more view stuff
+	   :
+	</h:form>
+    </body>
+</html>
+</f:subview>
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><ac:link><ri:page ri:content-title="3" /></ac:link> Create a backing
+bean in request scope which can process the error. (don't forget to
+register it on faces-config.xml)</p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">ErrorDisplay.java</ac:parameter><ac:plain-text-body><![CDATA[
+
+import cms.beans.framework.AbstractUIBean;
+
+import com.c2gl.jsf.framework.ApplicationResource;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+import javax.servlet.ServletException;
+
+public class ErrorDisplay extends AbstractUIBean {
+    private static final long serialVersionUID = 3123969847287207137L;
+    private static final String BEAN_NAME = ErrorDisplay.class.getName();
+
+    public String getInfoMessage() {
+	return "An unexpected processing error has occurred. Please cut and
+paste the following information" + " into an email and send it to <b>" +
+	some email address + "</b>. If this error " + "continues to occur
+please contact our technical support staff at <b>" +
+	some phone number etc + "</b>.";
+    }
+
+    public String getStackTrace() {
+	FacesContext context = FacesContext.getCurrentInstance();
+	Map requestMap = context.getExternalContext().getRequestMap();
+	Throwable ex = (Throwable)
+requestMap.get("javax.servlet.error.exception");
+
+	StringWriter writer = new StringWriter();
+	PrintWriter pw = new PrintWriter(writer);
+	fillStackTrace(ex, pw);
+
+	return writer.toString();
+    }
+
+    private void fillStackTrace(Throwable ex, PrintWriter pw) {
+	if (null == ex) {
+	    return;
+	}
+
+	ex.printStackTrace(pw);
+
+	if (ex instanceof ServletException) {
+	    Throwable cause = ((ServletException) ex).getRootCause();
+
+	    if (null != cause) {
+		pw.println("Root Cause:");
+		fillStackTrace(cause, pw);
+	    }
+	} else {
+	    Throwable cause = ex.getCause();
+
+	    if (null != cause) {
+		pw.println("Cause:");
+		fillStackTrace(cause, pw);
+	    }
+	}
+    }
+}
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>Also have a look at our ExceptionUtils class. It encapsulates the way
+how to get the real root cause</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+	[1](1.html)
+ List exceptions = ExceptionUtils.getExceptions(exception);
+	[2](2.html)
+ Throwable throwable = (Throwable) exceptions.get(exceptions.size()-1);
+	[3](3.html)
+ String exceptionMessage = ExceptionUtils.getExceptionMessage(exceptions);
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><ac:link><ri:page ri:content-title="1" /></ac:link> get a list of all
+exceptions - using getRootCause if available or
+getCause&lt;&lt;BR&gt;&gt;<br />
+<ac:link><ri:page ri:content-title="2" /></ac:link> get the initial
+exception&lt;&lt;BR&gt;&gt;<br />
+<ac:link><ri:page ri:content-title="3" /></ac:link> get the first exception
+with an message starting with the initial exception</p>
+
+<p>So the new fillStackTrace become</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+    private void fillStackTrace(Throwable ex, PrintWriter pw)
+    {
+	if (null == ex) {
+	    return;
+	}
+
+	List exceptions = ExceptionUtils.getExceptions(exception);
+	Throwable throwable = (Throwable)
+exceptions.get(exceptions.size()-1);
+
+	for (int i = 0; i<exceptions.size(); i++)
+	{
+	    if (i > 0)
+	    {
+		pw.println("Cause:");
+	    }
+	    throwable.printStackTrace(pw);
+	}
+    }
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>In the backing bean we construct a message which informs the user that
+something we didnt't plan for has happened with directions on who to call,
+what to do etc. We don't really care if they actually do cut-and-paste the
+error and email it to us as it is also in Tomcat's logs but giving the user
+something to do and become part of resolving the problem is always a good
+idea <ac:emoticon ac:name="smile" /></p>
+
+<h4>ViewExpiredException: No saved view state could be found for the view
+identifier</h4>
+
+<p>In some configurations, you might run into this problem exception with
+the error handling method shown above. This will happen if an error results
+in a forward, rather than redirect. The ''ViewHandler'' will call
+''response.sendError()'' in case of an error, which will lookup your
+''&lt;error-page&gt;'' declarations in ''web.xml'' and forward to the error
+url. If the error url is picked up by the ''FacesServlet'' (i.e. it's a JSF
+url), a new JSF lifecycle will be started. However, since this is a
+forward, the request object will still contain all of the request
+parameters, including ''&quot;javax.faces.ViewState&quot;'', which makes
+the request look like a postback to the ''ViewHandler''. Since it's a
+postback, the ''ViewHandler'' will expect a saved view, which is clearly
+not going to be there, since our ''viewId'' is now referencing the error
+page.</p>
+
+<p>This problem can be solved by customizing the ''ViewHandler'' to use
+''response.sendRedirect()'' instead of ''response.sendError()'', but that
+will mean that we can no longer use ''web.xml'' for specifying the error
+page mappings.</p>
+
+<p>Another way to handle this would be to use an intermediate step by
+specifying a non-JSF URL as the error page and then somehow redirecting to
+the JSF error page. For example, for the 404 error code you could specify
+''/error/404_redirect.html'':</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<html><head><meta http-equiv="Refresh" content="0;
+URL=/DPSV4/error/404.jsf"></head></html>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>This works, but requires you to hard code the context path.</p>
+
+<p>The solution I ended up with involves a ''RedirectServlet'':</p>
+<ac:macro ac:name="code"><ac:parameter
+ac:name="title">RedirectServlet.java</ac:parameter><ac:plain-text-body><![CDATA[
+public class RedirectServlet extends HttpServlet {
+	private static final String URL_PREFIX = "url=";
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse
+resp) throws ServletException, IOException {
+		String query = req.getQueryString();
+		if ( query.contains(URL_PREFIX) ) {
+			String url = query.replace(URL_PREFIX, "");
+			if ( !url.startsWith(req.getContextPath()) ) {
+				url = req.getContextPath() + url;
+			}
+			
+		resp.sendRedirect(url);
+		}
+	}
+
+	@Override
+	protected void doPost(HttpServletRequest req, HttpServletResponse
+resp) throws ServletException, IOException {
+		doGet(req, resp);
+	}
+
+}
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>used like this in ''web.xml'':</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<servlet>
+	    <servlet-name>Redirect Servlet</servlet-name>
+	   
+<servlet-class>ca.gc.agr.ops.web.jsf.redirect.RedirectServlet</servlet-class>
+	</servlet>    
+	<servlet-mapping>
+	    <servlet-name>Redirect Servlet</servlet-name>
+	    <url-pattern>/redirect</url-pattern>
+	</servlet-mapping>
+
+	<error-page>
+		<error-code>403</error-code>
+		<location>/redirect?url=/error/403.jsf</location>
+	</error-page>
+	<error-page>
+		<error-code>404</error-code>
+		<location>/redirect?url=/error/404.jsf</location>
+	</error-page>
+	<error-page>
+		<error-code>500</error-code>
+		<location>/redirect?url=/error/500.jsf</location>
+	</error-page>
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>With plain JSP </h3>
+
+<p>If you didn't require any JSF functionality in your JSP page it might be
+worth to consider using the following error.jsp</p>
+
+<p>[<a href="http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/error.jsp?view=markup">http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/error.jsp?view=markup</a>](<a-href="http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/error.jsp?view=markup">http://svn.apache.org/viewvc/myfaces/tomahawk/trunk/examples/simple/src/main/webapp/error.jsp?view=markup</a>.html)
+</p>
+
+<p>with this web.xml configuration</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<error-page>
+		<error-code>500</error-code>
+		<location>/error.jsp</location>
+	</error-page>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>This reduces the number of technologies required to show the error page
+which might improve the availablity of this page <ac:emoticon
+ac:name="wink" /></p>
+
+
+<h3>Custom error handler under Apache Geronimo JavaEE server</h3>
+
+<p>If you would use your own error handler
+(org.apache.myfaces.ERROR_REDIRECT_ALTERNATE_HANDLER) under Apache
+Geronimo, you must set properly your deployment plan (geronimo-web.xml
+usualy), otherwise you will have classloading problem of your class. By
+default the MyFaces classes are loaded to your classpath through
+dependencies at org.apache.geronimo.framework.jee-specs/CAR. This is OK for
+common cases, but if you instruct MyFaces to use your own error handler
+class, you get the error because MyFaces cannot find your class in calling
+class.forName(). Avoid this situation is quite simple - in your deployment
+plan specify dependencies on myfaces-api and myfaces-impl and then modify
+classloading via hidden-classes setting.</p>
+
+<p>A fragment of your dependency plan would be like this:</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<dep:dependencies>
+.
+.
+	<dep:dependency>
+		<dep:groupId>org.apache.myfaces.core</dep:groupId>
+		<dep:artifactId>myfaces-api</dep:artifactId>
+		<dep:type>jar</dep:type>
+	</dep:dependency>
+	<dep:dependency>
+		<dep:groupId>org.apache.myfaces.core</dep:groupId>
+		<dep:artifactId>myfaces-impl</dep:artifactId>
+		<dep:type>jar</dep:type>
+	</dep:dependency>
+.
+.
+</dep:dependencies>
+
+<dep:hidden-classes>
+	<dep:filter>javax.faces</dep:filter>
+	<dep:filter>org.apache.myfaces</dep:filter>
+</dep:hidden-classes>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>This solution was tested under Apache Geronimo 2.1.3., but will probably
+be similar in other versions.</p>
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/viewexpiredexception-and-session-expiry.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/viewexpiredexception-and-session-expiry.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/viewexpiredexception-and-session-expiry.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/managing-errors---infos---warnings/viewexpiredexception-and-session-expiry.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,40 @@
+Title: ViewExpiredException and session expiry
+<p>MyFaces might throw a ViewExpiredException following a session timeout,
+under certain conditions.<br />
+The issue arises in some servlet containers (e.g. WebSphere), with Server
+state-saving, and form-based login.</p>
+
+<p>Here is the scenario:</p>
+
+<ol>
+	<li>User logs in and starts using the MyFaces web application.</li>
+	<li>The session expires due to inactivity.</li>
+	<li>User clicks e.g. the 'Next' button on the page, triggering a
+POST.</li>
+	<li>The servlet container detects that the session has expired, and
+redirects the user to the login page (as configured in web.xml).</li>
+	<li>User logs in - and is automatically redirected to the page they
+were previously working on in 3.</li>
+	<li>ViewExpiredException is thrown ('No saved view state could be
+found for view identifier: ...').</li>
+</ol>
+
+
+
+<p>Why the ViewExpiredException in 6. ?  The request is not a postback -
+isn't the user just trying to view the page ?<br />
+When the servlet container detects the session expiry in 4., it stores the
+URL the user was trying to access, and the form's POST data for later use
+(e.g. in a cookie).<br />
+On login, the servlet container uses that data to redirect the user to the
+page they were trying to access, and to re-POST the form data.<br />
+This form data includes a javax.faces.ViewState (indicating that this is a
+postback) - however the view state referenced is no longer valid.</p>
+
+<p>The solution ?  If the servlet container you're using lets you configure
+session expiry behaviour, then you can turn off redirecting and re-POSTing
+form data after login.<br />
+Otherwise you will have to dive under the covers and clear the cookies
+storing the URL and form data.<br />
+On WebSphere, these cookies are WASReqURL and WASPostParam
+respectively.</p>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,9 @@
+Title: Working with tables
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="children"><ac:parameter
+ac:name="all">true</ac:parameter></ac:macro>
+
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/executing-methods-from-link-or-button-inside-a-table.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/executing-methods-from-link-or-button-inside-a-table.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/executing-methods-from-link-or-button-inside-a-table.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/executing-methods-from-link-or-button-inside-a-table.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,170 @@
+Title: Executing methods from link or button inside a table
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+<h3>Handling Command components within table columns</h3>
+
+<p>In a typical master/detail scenario, a table displays a Collection of
+objects. There is a command component (a link or button) in each table row
+that performs some operation on the object for that row (for example,
+navigating to a separate page that shows more details about that object, or
+allows it to be edited).</p>
+
+<p>The problem is that the command's &quot;action&quot; attribute points to
+the same backing bean method to run for each row. When the method is
+executed, it somehow needs to know which of the rows was actually
+selected.</p>
+
+<h3>Using f:setActionPropertyListener or t:updateActionListener </h3>
+
+<p>Note: The f:setActionPropertyListener tag was added in JSF1.2. For
+people using JSF1.1, the Tomahawk library provides t:updateActionListener
+which does the same thing.</p>
+
+<p>This approach causes two things to happen when a command component is
+clicked:<br />
+ 1. store the command component in a property on the backing bean, then<br
+/>
+ 2. run the &quot;action method&quot;, which can look at that property to
+see exactly which item was selected</p>
+
+<p>This solution looks something like the following:</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<h:dataTable var="emp" .... >
+ 
+<h:commandLink action="#{employeeAction.prepareForEdit}">
+    <h:outputText value="#{msgs.edit}" />
+    <t:updateActionListener property="#{employeeAction.currentEmployee}"
+value="#{emp}" />
+</h:commandLink>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>When the above link is clicked, JSF will first call the
+setCurrentEmployee(Employee) method on the backing bean (which should store
+its parameter as a member on the backing bean). The prepareForEdit method
+can then just use that member to know which specific employee was
+chosen.</p>
+
+<h3>Using the table's DataModel</h3>
+
+<p>Each table component (h:dataTable) has a DataModel object, and this
+DataModel knows which is the &quot;currently selected&quot; row.</p>
+
+<ol>
+	<li>An h:dataTable can be configured to use a !DataModel explicitly
+provided by your code, ie the &quot;value&quot; attribute of the
+h:dataTable can point to a backing-bean method that returns a !DataModel.
+If you are doing this, and the !DataModel object is cached in a member of
+your backing bean, then the &quot;action method&quot; that is triggered can
+simply access that member and call its getRowData() method to get the
+object for the &quot;selected row&quot;.</li>
+	<li>If the &quot;value&quot; attribute of the h:dataTable instead
+points to a backing-bean method that returns a List or similar collection,
+then the dataTable will internally create a !DataModel to wrap that list.
+You can access this DataModel instance by using the
+&quot;actionListener&quot; attribute on the command component, rather than
+the &quot;action&quot; one. The backing-bean method is then passed an
+ActionEvent object which contain a reference to the command-component that
+was clicked on; by walking up the component tree the enclosing UIData
+component can be found, and its DataModel then retrieved. Actually, it's
+even simpler, as the &quot;getRowData&quot; method on the UIData component
+can be used directly (it just delegates to the DataModel method).<br />
+The JSF page looks like this:
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<h:commandLink actionListener="#{employeeAction.prepareForEdit}">
+    <h:outputText value="#{msgs.edit}" />
+</h:commandLink>
+]
+]></ac:plain-text-body></ac:macro>
+And the backing bean looks like this:
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+  public void prepareForEdit(ActionEvent anEvent) {
+
+    YourBeanClass tmpBean = null;
+
+    UIComponent tmpComponent = anEvent.getComponent();
+
+    while (null != tmpComponent && !(tmpComponent instanceof UIData)) {
+      tmpComponent = tmpComponent.getParent();
+    }
+
+    if (tmpComponent != null && (tmpComponent instanceof UIData)) {
+      Object tmpRowData = ((UIData) tmpComponent).getRowData();
+      if (tmpRowData instanceof YourBeanClass) {
+	tmpBean = (YourBeanClass) tmpRowData;
+
+	//TODO Implementation of your method 
+
+      }
+    }
+
+    //TODO Exception Handling if UIData not found or tmpRowBean of wrong
+type
+
+  }
+]
+]></ac:plain-text-body></ac:macro></li>
+	<li>You could also use the &quot;binding&quot; attribute on the
+h:dataTable to make it accessable from the backing bean. However component
+bindings have their own problems and should be avoided where possible.</li>
+</ol>
+
+
+<h3>Passing params with f:param</h3>
+
+<p>If you are coming from Struts or some other servlet MVC framework you
+may have previously solved this problem by passing some kind of primary key
+as request parameters as part of a link, perhaps via something like
+this:</p>
+
+<ac:macro ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[<a href="/appContext/someAction.do?id=1234&userAction=prepareEdit">Edit</a>](cdata[<a-href="/appcontext/someaction.do?id=1234&useraction=prepareedit">edit</a>.html)
+]></ac:plain-text-body></ac:macro>
+
+<p>Using JSTL to create the above:</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<c:url value="someAction.do" var="url">
+   <c:param name="id" value="1234" />
+   <c:param name="userAction" value="prepareEdit" />
+</c:url>
+<a href="${url}">Edit</a>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>It is possible to use this approach with JSF, but it is not in the
+spirit of JSF; the solutions documented above are generally considered
+better. Nevertheless, this can be implemented as follows:</p>
+
+<p>Use an f:param tag inside of the commandButton or commandLink:</p>
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<t:dataTable var="emp" .... >
+
+ <h:commandLink id="editLink" action="#{employeeAction.prepareEdit}">
+  <h:outputText value="#{msg.edit}"/>
+  <f:param name="id" value="#{emp.id}"/>
+</h:commandLink>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>To then get a handle to this request parameter in your
+&quot;prepareEdit&quot; method, you could do:</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+FacesContext context = FacesContext.getCurrentInstance();
+Map map = context.getExternalContext().getRequestParameterMap();
+String employeeID = (String) map.get("id");
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>Note that in this case the parameter is a String, which you'll have to
+map to the appropriate object id yourself. Plus, you have extra lines of
+code just to get a handle to the map holding the parameters. Sure you can
+push that off to a utility class, but the above solutions are cleaner ways
+to handle this.</p>
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/get-row-data-from-an-actionlistener.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/get-row-data-from-an-actionlistener.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/get-row-data-from-an-actionlistener.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/jsf-and-myfaces-howtos/working-with-tables/get-row-data-from-an-actionlistener.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,61 @@
+Title: Get row data from an ActionListener
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+<h2>Handling buttons or links in table rows</h2>
+
+<p>If you you have a command link or button in a row of a dataTable, there
+is an easy way to get to row bean from an <a
+href="http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/event/ActionListener.html">javax.faces.event.ActionListener</a>.</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<h:dataTable value="#{ResultsBean.hitSet.hits}" var="hit">
+  <h:column>
+    <h:commandLink>
+      <f:actionListener type="net.java.OrderActionListener" />
+      <h:outputText value="Order" />
+    </h:commandLink>
+    ...
+  </h:column>
+</h:dataTable>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p>By this simple Java code in your subclass of <a
+href="http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/event/ActionListener.html">javax.faces.event.ActionListener</a>
+you get the row bean.</p>
+
+<ac:macro
+ac:name="code"><ac:default-parameter>java</ac:default-parameter><ac:plain-text-body><![CDATA[
+public class OrderActionListener implements ActionListener {
+
+  public void processAction(ActionEvent anEvent) throws
+AbortProcessingException {
+
+    YourBeanClass tmpBean = null;
+
+    UIComponent tmpComponent = anEvent.getComponent();
+
+    while (null != tmpComponent && !(tmpComponent instanceof UIData)) {
+      tmpComponent = tmpComponent.getParent();
+    }
+
+    if (tmpComponent != null && (tmpComponent instanceof UIData)) {
+      Object tmpRowData = ((UIData) tmpComponent).getRowData();
+      if (tmpRowData instanceof YourBeanClass) {
+	tmpBean = (YourBeanClass) tmpRowData;
+
+	//TODO Implementation of your method 
+
+      }
+    }
+
+    //TODO Exception Handling if UIData not found or tmpRowBean of wrong
+type
+
+  }
+}
+]
+]></ac:plain-text-body></ac:macro>
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,8 @@
+Title: Migration Guide
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="children" />
+
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-1.2-to-2.0---2.1.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-1.2-to-2.0---2.1.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-1.2-to-2.0---2.1.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-1.2-to-2.0---2.1.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,69 @@
+Title: From 1.2 to 2.0 - 2.1
+<p>First of all, JSF 2.0 support both JSP and facelets files. In theory you
+can change your JSF implementation version and keep using your old JSF 1.2
+libraries. But it is usual that the same &quot;JSF 2.0 library
+alternates&quot; does not work as expected, because they could target only
+facelets as View Declaration Language (VDL). One known example is MyFaces
+Tomahawk that was written in that way to keep it closer to the spec.</p>
+
+<p>If your are already working with facelets, the necessary changes are
+minimal, but if you are working with JSP it is a good moment to change to
+facelets for JSF 2.0. In that way you'll enjoy all cool features like:</p>
+
+<ul>
+	<li>Partial State Saving</li>
+	<li>Composite Components</li>
+	<li>JSF 2.0 Resource Handling</li>
+	<li>JSF 2.0 Ajax</li>
+</ul>
+
+
+<p>When migrating JSF 1.2 (or even 1.1) applications, keep in mind that JSF
+2.1 has some improvements that makes easier convert JSP applications into
+facelets applications. It is strongly suggested to move directly to JSF
+2.1.</p>
+
+<h3>Moving from .jsp to facelets .xhtml</h3>
+
+<p>Just follow the checklist:</p>
+
+<ul>
+	<li>Rename your files to .xhtml.</li>
+	<li>update all your headers.</li>
+	<li>replace your jsp:include with ui:import.</li>
+	<li>remove your f:verbatim tags.</li>
+	<li>update your faces-config.xml navigation rules.</li>
+</ul>
+
+
+<h3>Upgrading .jspx files</h3>
+
+<p>You can configure facelets engine to process .jspx files instead JSP,
+minimizing the necessary changes required for your application. To do that,
+follow this list:</p>
+
+<ul>
+	<li>Configure facelets engine to handle files in different ways
+using &lt;facelets-processing&gt; tag inside
+&lt;faces-config-extensions&gt; entry on faces-config.xml (For more
+information see JSF 2.1 spec Appendix A 1.2.1.1 The facelets-processing
+element).</li>
+</ul>
+
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+<faces-config xmlns="http://java.sun.com/xml/ns/javaee" 
+	      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+	      http://java.sun.com/xml/ns/javaee/web-facesconfig_2_1.xsd"
+	      version="2.1">
+  <faces-config-extension>
+    <facelets-processing>
+      <file-extension>.jspx</file-extension>
+      <process-as>jspx</process-as>
+    </facelets-processing>
+  </faces-config-extension>
+</faces-config>
+]
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-2.0-to-2.1.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-2.0-to-2.1.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-2.0-to-2.1.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/migration-guide/from-2.0-to-2.1.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,7 @@
+Title: From 2.0 to 2.1
+<p>From spec point of view, JSF 2.1 is a maintenance release 2 from JSF
+2.0, so any application written for JSF 2.0 will work with 2.1 jars. </p>
+
+<p>There are no major changes between those versions than can cause you
+incompatibilities. By that reason, in practice both lines (2.0 and 2.1) are
+maintained by MyFaces Community at the same time.</p>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/quick-start.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/quick-start.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/quick-start.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/quick-start.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,176 @@
+Title: Quick Start
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+
+<h2>Step 1: Take a look at the examples</h2>
+
+<p>Your first step with Apache MyFaces should be to have a look at our
+examples application. In the following links (kindly hosted by Irian
+Solutions GmbH) you will find demo applications running with MyFaces.</p>
+
+<ul>
+	<li><a href="http://www.irian.at/myfaces">Tomahawk and Sandbox
+Examples</a> (and look to the bottom for Tomahawk Examples and Sandbox
+Examples links)</li>
+	<li><a href="http://www.irian.at/adfFaces/">Trinidad
+Examples</a></li>
+	<li><a href="http://www.irian.at/tobago/">Tobago Examples</a></li>
+</ul>
+
+
+<p>You can deploy the examples application for yourself. All you need to do
+to get up and running is to follow the steps below!:</p>
+
+<h2>Step 2: Deploy MyFaces Tomahawk example application.</h2>
+
+<p>The most simple example you can try is the ones bundled with tomahawk,
+which at the begining of MyFaces project was the example application
+bundled with MyFaces Core.</p>
+
+<h3>What you need for the Examples Application</h3>
+
+<ul>
+	<li>A web server like Apache Tomcat. The example shown runs on 5.x,
+6.x or 7.x, but note JSF 1.2 and later versions requires tomcat 6.x or
+upper. Download it from <a href="http://tomcat.apache.org">here</a>.</li>
+	<li>Go to <a
+href="http://myfaces.apache.org/tomahawk/download.html">Tomahawk download
+page</a> and download the webapps assembly (tomahawk-examples-X.X.X.zip or
+tomahawk-examples-X.X.X.tgz)</li>
+</ul>
+
+
+<h3>Installing and Running the Examples</h3>
+
+<ul>
+	<li>Unpack the MyFaces examples archive tomahawk-examples.X.X.X.zip
+(or tomahawk-examples-X.X.X.tgz) to a directory of your choice.</li>
+	<li>Remove any previous MyFaces webapps from your Tomcat
+installation and clean up your Tomcat work dir. Also make sure that there
+is no jsf-api.jar or jsf-impl.jar (i.e. Suns API and implementation) in the
+classpath or in one of Tomcat's lib directories (for Tomcat 5.x look on
+common/lib or shared/lib, in tomcat 6.x or 7.x look on /lib folder).</li>
+	<li>Copy the file myfaces-example-simple.war (or any of the other
+example war-files, myfaces-example-simple20.war for JSF 2.0 variant) to the
+webapps dir of your Tomcat installation directory - and check once more
+that there is no old myfaces-examples directory there <ac:emoticon
+ac:name="wink" /></li>
+	<li>Start Tomcat, if its not already running.</li>
+	<li>Start your browser and enjoy it at <a
+href="http://localhost:8080/myfaces-example-simple20">http://localhost:8080/myfaces-example-simple20</a>.</li>
+</ul>
+
+
+<h3>Using MyFaces in your own web application</h3>
+
+<p>Suggested step:</p>
+
+<ul>
+	<li>Check the myfaces wiki for information about compatibility with
+your servlet container.</li>
+</ul>
+
+
+<p>There are three possible ways to start off with MyFaces, one
+(recomended) is to start using myfaces archetypes:</p>
+
+<ul>
+	<li>Download and Install Maven</li>
+	<li>Execute mvn archetype:create goal using one available
+archetype. For more info you can look here</li>
+</ul>
+
+
+<p>The second possibility is to start from the example-app:</p>
+
+<ul>
+	<li>If you want to have it simple, take the
+tomahawk-examples-X.X.X.zip you downloaded before for looking at the
+examples, and extract the myfaces-examples-blank-X.X.X.war file (MyFaces
+binary)</li>
+	<li>Rename the myfaces-examples-blank-X.X.X.war file to
+myfaces-examples-blank-X.X.X.zip, and extract this file - you have a
+working directory structure for a MyFaces application at hand after this
+step.</li>
+</ul>
+
+
+<p>The third possibility is to download the core implementation and/or
+tomahawk (dependent on if you want to use the RI and the tomahawk
+components, or only MyFaces), and start from there:</p>
+
+<ul>
+	<li>Alternatively, download the latest MyFaces binary release. You
+can download only the implementation (aka core) or the implementation and
+tomahawk.</li>
+	<li>Copy all *.jar files into your WEB-INF/lib directory. Some of
+the jar-files are optional, you can find more info on: <a
+class="external-link"
+href="http://myfaces.apache.org/impl/dependencies.html"
+rel="nofollow">http://myfaces.apache.org/impl/dependencies.html</a> and <a
+class="external-link"
+href="http://myfaces.apache.org/tomahawk/dependencies.html"
+rel="nofollow">http://myfaces.apache.org/tomahawk/dependencies.html</a></li>
+</ul>
+
+
+<p>After you have downloaded the necessary packages and setup your project
+hierarchy, do this:</p>
+
+<p> *Make sure that there is no jsf-api.jar (i.e. Suns API implementation)
+in the classpath or in one of your container's shared lib directories (e.g.
+common/lib or shared/lib for Tomcat).</p>
+<ul>
+	<li>Configure your webapp's web.xml file (see conf/web.xml for
+example and documentation)</li>
+	<li>Add the following lines to your JSPs:</li>
+</ul>
+
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
+
+	<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>Using the MyFaces Tomahawk in your own web application</h3>
+
+<ul>
+	<li>If you don't use the MyFaces implementation, you will need to
+add the file tomahawk.jar and its dependencies (see above) to your web-app
+directory.</li>
+	<li>To be able to use the MyFaces Tomahawk add the following line
+to your JSPs:</li>
+</ul>
+
+
+<ac:macro
+ac:name="code"><ac:default-parameter>xml</ac:default-parameter><ac:plain-text-body><![CDATA[
+	<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
+
+	<%@ taglib uri="http://myfaces.apache.org/wap" prefix="wap" %>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ul>
+	<li>For using the Tomahawk components, it's also very important to
+setup the MyFaces Extensions-Filter. You find the explanations for doing
+this under: <a class="external-link"
+href="http://myfaces.apache.org/tomahawk/extensionsFilter.html"
+rel="nofollow">http://myfaces.apache.org/tomahawk/extensionsFilter.html</a></li>
+</ul>
+
+
+<h3>Tutorials for getting started with JSF</h3>
+
+<ul>
+	<li><a
+href="http://www.coreservlets.com/JSF-Tutorial/">Core-Servlets JSF Tutorial
+by Marty Hall</a></li>
+</ul>
+
+
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/core/user-guide/working-with-myfaces-core-integration-tests.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/core/user-guide/working-with-myfaces-core-integration-tests.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/core/user-guide/working-with-myfaces-core-integration-tests.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/core/user-guide/working-with-myfaces-core-integration-tests.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,52 @@
+Title: Working with MyFaces Core integration tests
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>
+<p>MyFaces core provides a submodule for running integration tests in
+various environments and configurations. The module can be found at
+core/integration-tests. The different submodules of the integration-test
+module include different configurations and environments (e.g. servlet 2.5
+and el 1.0 or servlet 3.0 and el 2.2).</p>
+
+<p>The MyFaces core integration tests use the cargo maven plugin to start
+and stop different containers and use HtmlUnit to write the test cases
+against the running container.</p>
+
+<h3>Running a core build with integration-tests</h3>
+
+<p>Adding the profile &quot;integration-tests&quot; to the maven build will
+automatically add the integration-tests submodule and thus execute all
+integration-tests.</p>
+
+<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
+mvn clean install -Pintegration-tests
+]
+]></ac:plain-text-body></ac:macro> 
+
+<h3>Running a specific integration-test module</h3>
+
+<p>Just go to the desired integration-test module and execute a standard
+maven build lifecycle, e.g.</p>
+
+<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
+cd integration-tests/servlet25-el10-basic-tests/
+mvn clean install
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>Starting an integration-test environment for manual tests</h3>
+
+<p>The cargo maven plugin provides a mojo for running a container with the
+given configuration until Ctrl+C is entered in the console (just like the
+jetty-maven-plugin).</p>
+
+<ac:macro ac:name="code"><ac:plain-text-body><![CDATA[
+mvn clean package cargo:run
+]
+]></ac:plain-text-body></ac:macro>
+
+<h3>Creating a new integration-test submodule with a specific
+configuration</h3>
+
+<p>TODO</p>
+<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{scrollbar}](cdata[{scrollbar}.html)
+]></ac:plain-text-body></ac:macro>

Added: myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,9 @@
+Title: GSOC and MyFaces
+<p>Over the past years, many people participated in GSOC program.</p>
+
+<p>Take a look at <a
+href="http://community.apache.org/gsoc.html">Instructions for apply to GSOC
+at ASF</a> for more information about how to apply.</p>
+
+<p>Under this section you can see documentation of previous GSOC projects
+done in MyFaces land.</p>

Added: myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces/gsoc-html5-dnd-prototypes.mdtext
URL: http://svn.apache.org/viewvc/myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces/gsoc-html5-dnd-prototypes.mdtext?rev=1561922&view=auto
==============================================================================
--- myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces/gsoc-html5-dnd-prototypes.mdtext (added)
+++ myfaces/site/cms-site/trunk/content/wiki/gsoc-and-myfaces/gsoc-html5-dnd-prototypes.mdtext Tue Jan 28 01:49:11 2014
@@ -0,0 +1,536 @@
+Title: GSoC HTML5 DnD Prototypes
+<p><span style="color: rgb(255,0,0);"><strong>The prototypes here were used
+for getting the feedback of other developers, during the first part (design
+part) of GSOC project. They are all obsolete now, and only kept as a
+reference example for future students .</strong></span></p>
+
+<p>See how some component libraries handle drag and drop (not HTML5
+though):<br />
+<a
+href="http://www.primefaces.org:8080/prime-showcase/ui/draggableBasic.jsf">PrimeFacesDraggable</a><br
+/>
+<a
+href="http://www.primefaces.org:8080/prime-showcase/ui/droppableBarca.jsf">PrimeFacesDroppable</a><br
+/>
+<a
+href="http://livedemo.exadel.com/richfaces-demo/richfaces/dragSupport.jsf">RichFacesDnD</a><br
+/>
+<a
+href="http://download.oracle.com/docs/cd/E15523_01/apirefs.1111/e12419/toc.htm#DragDrop">ADFDnD</a><br
+/>
+<a
+href="http://component-showcase.icefaces.org/component-showcase/showcase.iface">IceFacesDnD</a></p>
+
+<h4>&lt;fx:dragSource&gt;</h4>
+
+<h6>Extends:&nbsp;<span style="color:
+rgb(0,0,0);">ClientBehavior</span></h6>
+
+<h6>Attributes:</h6>
+
+<table><tbody>
+<tr>
+<th><p> Name </p></th>
+<th><p> Required? </p></th>
+<th><p> Values </p></th>
+<th><p> Description </p></th>
+</tr>
+<tr>
+<td><p> action </p></td>
+<td><p> required </p></td>
+<td><p> Comma separated set or String[](.html)
+ or Collection&lt;String&gt; of copy, copyLink, copyMove, link, linkMove,
+move, all. </p></td>
+<td><p> Allowed DnD drag action from this source </p></td>
+</tr>
+<tr>
+<td><p> dropTargetTypes </p></td>
+<td><p> optional </p></td>
+<td><p> Can be comma separated set or String[](.html)
+ or Collection&lt;String&gt; </p></td>
+<td><p> With this property, we can specify which types of drop zones we can
+make DnD from this source </p></td>
+</tr>
+<tr>
+<td><p> param </p></td>
+<td><p> optional </p></td>
+<td><p> EL and literal </p></td>
+<td><p> Parameter to send to server when drop operation is done. </p></td>
+</tr>
+</tbody></table>
+
+
+<h6>Notes:&nbsp;</h6>
+
+<ul>
+	<li>May use <a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd">&quot;custom
+non-visible data&quot;</a>, &quot;data-*&quot; when at least one browser
+starts supporting it.</li>
+</ul>
+
+
+<h6>References:</h6>
+
+<ul>
+	<li><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd">http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd</a></li>
+	<li><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data">http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_and_Drop">https://developer.mozilla.org/En/DragDrop/Drag_and_Drop</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/DataTransfer">https://developer.mozilla.org/En/DragDrop/DataTransfer</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types">https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_Operations">https://developer.mozilla.org/En/DragDrop/Drag_Operations</a></li>
+</ul>
+
+
+
+
+
+
+<h4>&lt;fx:dropTarget&gt;</h4>
+
+<h6>Extends:&nbsp;<span style="color: rgb(0,0,0);">AjaxBehavior</span></h6>
+
+<h6>Attributes:</h6>
+
+<table><tbody>
+<tr>
+<th><p> Name </p></th>
+<th><p> Required? </p></th>
+<th><p> Values </p></th>
+<th><p> Description </p></th>
+</tr>
+<tr>
+<td><p> actions </p></td>
+<td><p> required </p></td>
+<td><p> Comma separated set or String[](.html)
+ or Collection&lt;String&gt; of copy, copyLink, copyMove, link, linkMove,
+move, all. </p></td>
+<td><p> Allowed DnD actions. <br class="atl-forced-newline" />
+If action of dragEvent are not one of these, DnD will stop. </p></td>
+</tr>
+<tr>
+<td><p> dropListener </p></td>
+<td><p> optional </p></td>
+<td><p> EL </p></td>
+<td><p> Listener method to handle DnD operation on server side. </p></td>
+</tr>
+<tr>
+<td><p> rerender </p></td>
+<td><p> optional </p></td>
+<td><p> EL and literal </p></td>
+<td><p> same with &lt;f:ajax&gt; rerender attribute. </p></td>
+</tr>
+<tr>
+<td><p> types </p></td>
+<td><p> optional </p></td>
+<td><p> Can be comma separated set or String[](.html)
+ or Collection&lt;String&gt;. </p></td>
+<td><p> Used in conjunction with &lt;fx:dragSource&gt;'s dropTargetTypes
+attribute. Types of this dropTarget. </p></td>
+</tr>
+<tr>
+<td><p> acceptMimeTypes </p></td>
+<td><p> optional </p></td>
+<td><p> Can be comma separated set or String[](.html)
+ or Collection&lt;String&gt;. </p></td>
+<td><p> If this is set, only content dropped into this zone with defined
+mime type will be accepted and sent to server-side drop listener. <br
+class="atl-forced-newline" />
+HTML5 DnD allows us to drop anything into drop zone<a href="http://html5demos.com/drag-anything">[2](2.html)
+</a> : files from desktop, images on some other document<a
+href="http://apirocks.com/html5/html5.html#slide13">[3]</a> , etc. So this
+property is a filter. <br class="atl-forced-newline" />
+If value is &quot;*&quot;, any content dropped into this zone will be
+accepted. All type info and data of dropped stuff will be sent to
+dropListener. <br class="atl-forced-newline" />
+For example, if this is true and we dragNdrop some image on any Html
+page(even not generated by JSF), dropListener will be triggered with the
+following data: <br class="atl-forced-newline" />
+content-type |	value <br class="atl-forced-newline" />
+text/uri-list | <a
+href="http://example.org/someImage.png">http://example.org/someImage.png</a>Text
+| <a
+href="http://example.org/someImage.png">http://example.org/someImage.png</a>text/plain
+| <a
+href="http://example.org/someImage.png">http://example.org/someImage.png</a>URL
+| <a
+href="http://example.org/someImage.png">http://example.org/someImage.png</a><br
+class="atl-forced-newline" />
+Another example may be dropping files from your desktop, but what to do
+with them? We'll have &lt;hx:inputFileUpload&gt; for DnD file uploading. So
+better not to accept files, or even they're accepted, we'd better not to
+send their information to server. <br class="atl-forced-newline" />
+Mime type can be something like &quot;text/x-myfaces-html5-dnd-source&quot;
+for MyFaces generated components. <br class="atl-forced-newline" />
+Default to &quot;text/x-myfaces-html5-dnd-source&quot;, thus only MyFaces
+generated components can be dropped into this zone. <br
+class="atl-forced-newline" /> </p></td>
+</tr>
+</tbody></table>
+
+
+
+<h6>Notes:&nbsp;</h6>
+
+<h6>References:</h6>
+
+<p><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd">http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd</a></p>
+
+<p><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data">http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data</a></p>
+
+<p><a
+href="http://html5demos.com/drag-anything">http://html5demos.com/drag-anything</a></p>
+
+<p><a
+href="http://apirocks.com/html5/html5.html#slide13">http://apirocks.com/html5/html5.html#slide13</a></p>
+
+<p><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_and_Drop">https://developer.mozilla.org/En/DragDrop/Drag_and_Drop</a></p>
+
+<p><a
+href="https://developer.mozilla.org/En/DragDrop/DataTransfer">https://developer.mozilla.org/En/DragDrop/DataTransfer</a></p>
+
+<p><a
+href="https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types">https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types</a></p>
+
+<p><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_Operations">https://developer.mozilla.org/En/DragDrop/Drag_Operations</a></p>
+
+
+
+<h4>&lt;hx:panel&gt;</h4>
+
+<h6>Extends:&nbsp;<span style="color: rgb(0,0,0);">&lt;t:div&gt; or
+something (I don't think a dependency to Tomahawk is good. So, need to
+rewrite that stuff or copy them, preferably with
+maven-dependency-plugin)</span></h6>
+
+<h6>Attributes:</h6>
+
+<p>ondragstart, ondragend, ondragenter, ondragover, ondrop, other DnD
+behavioral attributes<br />
+dragStartStyle, dragStartStyleClass: CSS stuff to set when this component
+is being dragged<br />
+dragOverStyle, dragOverStyleClass: CSS stuff to set when something is
+dragged onto this component
+<br class="atl-forced-newline" />
+other stuff that wrapped components don't support (not clear yet!)</p>
+
+<h6>Notes:&nbsp;</h6>
+
+<ul>
+	<li>This is just like &lt;t:div&gt; or &lt;rich:panel&gt;. For
+example DnD does not work with components that dont support
+&quot;dragstart&quot; clientbehavior event. That is why &lt;hx:panel&gt; is
+necessary. We can wrap those components (ie. h:inputText, h:panelGrid) with
+&lt;hx:panel&gt;.</li>
+</ul>
+
+
+<h6>References:</h6>
+
+<ul>
+	<li><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd">http://www.whatwg.org/specs/web-apps/current-work/multipage/dnd.html#dnd</a></li>
+	<li><a
+href="http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data">http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#embedding-custom-non-visible-data</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_and_Drop">https://developer.mozilla.org/En/DragDrop/Drag_and_Drop</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/DataTransfer">https://developer.mozilla.org/En/DragDrop/DataTransfer</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types">https://developer.mozilla.org/En/DragDrop/Recommended_Drag_Types</a></li>
+	<li><a
+href="https://developer.mozilla.org/En/DragDrop/Drag_Operations">https://developer.mozilla.org/En/DragDrop/Drag_Operations</a>U</li>
+</ul>
+
+
+
+
+<h1>Usage of prototypes:</h1>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dragSource&gt; with
+dropTargetType</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:panel id="draggable1" >
+	<!-- SOME CONTENT -->
+	<fx:dragSource action="copy"
+dropTargetTypes="#{someBean.optionaldropTargetTypes}" 
+		param="#{someBean.dndParamToSendToServer}"/>
+</hx:panel>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<div id="draggable1" draggable="true"
+		ondragstart="return dragStart(event, 'copy',
+{'firstdropTargetType','seconddropTargetType'},
+'literalDndParamToSendToServer')"
+		>
+	<!-- RENDERED CONTENT -->
+</div>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dragSource&gt; with event handler
+chains</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:panel id="draggable2" 
+		ondragstart="log('dragging');" 
+		ondragend="alert('Drag ended. May not have been dropped
+succesfully though!')">
+	<!-- SOME CONTENT -->
+	<fx:dragSource action="move" param="anotherDndParamToSendToServer"
+/>
+</hx:panel>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<div id="draggable2" draggable="true"
+		ondragstart="log('dragging'); return dragStart(event,
+'move', null, 'secondDndValueToSendServer')"
+		ondragend="alert('Drag ended. May not have been dropped
+succesfully though!')"
+		>
+	<!-- RENDERED CONTENT -->
+</div>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dragSource&gt; within &lt;hx:inputText&gt; (allowed with HTML5,
+doesn't make sense though)</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:inputText id="draggableInputText">
+	<fx:dragSource action="move"/>
+</hx:panel>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<input type="text" id="draggableInputText" draggable="true"
+		ondragstart="return dragStart(event, 'move')" />
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dropTarget&gt; with type and
+rerender</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:panel id="dropTarget1">
+	<!-- SOME CONTENT -->
+	<fx:dropTarget actions="move"
+dropListener="#{someBean.dropListener}" 
+		rerender="draggable1" types="firstdropTargetType"/>
+</hx:panel>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<div id="dropTarget1" 
+	ondragenter="dragEnter(event,{'move'},{'firstdropTargetType'}),
+{'text/x-myfaces-html5-dnd-source'}"
+	ondragover="dragOver(event)"
+	ondrop="drop(event, 'stuff necessary to trigger
+someBean.dropListener and rerender draggable1 using jsf.ajax.request')">
+	<!-- RENDERED CONTENT -->
+</div>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dropTarget&gt; with handler
+chaining</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:panel id="dropTarget2"
+	ondragover="makeRedBorder();"
+	ondragleave="clearRedBorder();"
+	ondrop="makeGreenBorder();"
+	>
+	<!-- SOME CONTENT -->
+	<fx:dropTarget actions="copy,move"
+dropListener="#{someBean.dropListener}" />
+</hx:panel>
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<div id="dropTarget2" 
+	ondragenter="dragEnter(event,{'copy','move'}), null,
+{'text/x-myfaces-html5-dnd-source'}"
+	ondragover="makeRedBorder(); dragOver(event)"
+	ondragleave="clearRedBorder();"
+	ondrop="makeGreenBorder();drop(event)">
+	<!-- RENDERED CONTENT -->
+</div>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">usage:
+&lt;fx:dropTarget&gt; that accepts some specified mime typed
+content</ac:parameter><ac:plain-text-body><![CDATA[
+<hx:panel id="dropTarget3">
+	<!-- SOME CONTENT -->
+	<fx:dropTarget actions="copy"
+dropListener="#{someBean.dropListener}" acceptMimeTypes="text/plain, URL"
+/>
+</hx:panel>
+
+]
+]></ac:plain-text-body></ac:macro>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">xml</ac:parameter><ac:parameter ac:name="title">expected
+HTML5 code</ac:parameter><ac:plain-text-body><![CDATA[
+<div id="dropTarget3" 
+	ondragenter="dragEnter(event,{'copy','move'}, null, {'text/plain',
+'URL'})"
+	ondragover="dragOver(event)"
+	ondrop="drop(event)">
+	<!-- RENDERED CONTENT -->
+</div>
+]
+]></ac:plain-text-body></ac:macro>
+
+<p><br class="atl-forced-newline" />
+<br class="atl-forced-newline" />
+And here is the script:
+<br class="atl-forced-newline" />
+<br class="atl-forced-newline" /></p>
+
+<ac:macro ac:name="code"><ac:parameter
+ac:name="lang">js</ac:parameter><ac:parameter ac:name="title">Javascript
+Stuff</ac:parameter><ac:plain-text-body><![CDATA[
+var paramMimeType = 'text/x-myfaces-html5-dnd-param';
+var myFacesComponentSourceMimeType = 'text/x-myfaces-html5-dnd-source';
+var dropTargetMimeType = 'text/x-myfaces-html5-drop-zone-type';
+var myFacesComponentSourceConstant = 'org.apache.myfaces';
+
+/*
+ * This function is only used by MyFaces generated draggable elements, the
+ones that have <fx:dragSource> behavior.
+ */
+function dragStart(event, effectAllowed, paramToSendToServer,
+dropTargetTypes) {
+
+	//set allowed effect
+	event.dataTransfer.effectAllowed = effectAllowed;	//only
+allow some specific event
+
+	//with this, drop zone will understand that source of this dnd
+operation is some MyFaces component
+	event.dataTransfer.setData(myFacesComponentSourceMimeType,
+myFacesComponentSourceConstant);
+
+	//this will be set if we want to send an optional parameter to the
+server-side drop listener
+	if(paramToSendToServer)
+		event.dataTransfer.setData(paramMimeType,
+valueToSendToServer);	      
+
+	//this will be set if we want to make the drop only into specific
+dropTargets with specific types
+	if(dropTargetType)
+		event.dataTransfer.setData(dropTargetMimeType,
+dropTargetTypes);	 //in fact, dropTargetTypes is an array. need to
+iterate 	
+      
+	return true;
+}
+
+function dragEnter(event, allowedEffects, dropTargetTypes,
+acceptedMimeTypes) {
+	//check allowed mime types first
+	var found = false;
+	var foundTypes = acceptedMimeTypes.filter(function (mimeType)
+event.dataTransfer.types.contains(mimeType));
+	
+	//if even one of the event mime types are not allowed, stop DnD  
+	if(foundTypes.length == 0)
+		return true; //don't cancel the event, thus stop DnD
+	
+	//check allowed effect
+	//changeIt: allowedEffects is an array in fact, so need to iterate
+	if (event.dataTransfer.effectAllowed != allowedEffect)		
+		return true; //don't cancel the event, thus stop DnD
+
+	//check drop zone type
+	//changeIt: in fact these are arrays too. need to iterate or use
+contains() function
+	if (event.dataTransfer.getData(dropTargetMimeType) !=
+dropTargetTypes)
+		return true; //don't cancel the event, thus stop DnD
+
+	//cancel the event. this is necessary for DnD execution 
+	if (event.preventDefault)	
+		event.preventDefault();
+	
+	return false;
+}
+
+function dragOver(event){
+	//don't check source, allowedEffect and dropTargetType, since they
+are checked at dragEnter function
+	
+	//show same user hint effect specified by drag source 
+	event.dataTransfer.dropEffect = event.dataTransfer.effectAllowed;   
+
+	//cancel the event, so effect on screen is updated
+	if (event.preventDefault) 
+		event.preventDefault(); 
+
+	return false;
+}
+
+function drop(event, jsf_ajax_request_necessary_stuff){
+	//cancel the event. this is necessary for DnD execution 
+	if (event.preventDefault) 
+		event.preventDefault();
+
+	//CALL jsf.ajax.request with constructing parameters from
+jsf_ajax_request_necessary_stuff
+	//this call should trigger the dropListener and make the rerender
+operation
+	//need to send event mime types and values too!
+
+	return false;
+}
+]
+]></ac:plain-text-body></ac:macro>