Return-Path: Delivered-To: apmail-myfaces-dev-archive@www.apache.org Received: (qmail 63318 invoked from network); 10 Apr 2006 15:25:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Apr 2006 15:25:23 -0000 Received: (qmail 61917 invoked by uid 500); 10 Apr 2006 15:25:21 -0000 Delivered-To: apmail-myfaces-dev-archive@myfaces.apache.org Received: (qmail 61863 invoked by uid 500); 10 Apr 2006 15:25:20 -0000 Mailing-List: contact dev-help@myfaces.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "MyFaces Development" Delivered-To: mailing list dev@myfaces.apache.org Received: (qmail 61852 invoked by uid 99); 10 Apr 2006 15:25:20 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2006 08:25:20 -0700 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [192.87.106.226] (HELO ajax.apache.org) (192.87.106.226) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 10 Apr 2006 08:25:20 -0700 Received: from ajax (localhost.localdomain [127.0.0.1]) by ajax.apache.org (Postfix) with ESMTP id EA1FBD4A02 for ; Mon, 10 Apr 2006 16:24:58 +0100 (BST) Message-ID: <999628498.1144682698956.JavaMail.jira@ajax> Date: Mon, 10 Apr 2006 16:24:58 +0100 (BST) From: "Andrew Robinson (JIRA)" To: dev@myfaces.apache.org Subject: [jira] Created: (MYFACES-1276) Add new methods to HtmlFormBaseRenderer to ease integration support with AjaxAnywhere MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Add new methods to HtmlFormBaseRenderer to ease integration support with AjaxAnywhere ------------------------------------------------------------------------------------- Key: MYFACES-1276 URL: http://issues.apache.org/jira/browse/MYFACES-1276 Project: MyFaces Core Type: Improvement Versions: 1.1.1 Reporter: Andrew Robinson Fix For: 1.1.3-SNAPSHOT, 1.1.1 One method of implementing AJAX is to re-render the page and only send pieces down to the browser. This is the way AjaxAnywhere works. However, it is not easy to get this to work in MyFaces with HTML forms. The issue: AJAX needs a way to identify HTML to replace on AJAX response. This is usually done via id: "document.getElementById('idFromAjaxResponse').innerHtml = reponseData". However, there is no containing HTML element for the "special" form elements. These "special" elements include: 1) input type="hidden" elements that are rendered for parameters, client-side state, etc. 2) script tag that contains the clear_[formid]() JavaScript function that uses the above hidden input elements In 1.1.1, these were placed at the top and bottom of the form. In 1.1.2/3 they are put only at the bottom, but in neither is the capability that I would like. Workaround I used: Extended the HtmlFormRenderer and buffered the output of the endcodeEnd and encodeBegin. Then I loop through the buffer and strip out all hidden input elements and JavaScript tags. I then add the stripped portion into a new SPAN element that is formatted for AjaxAnywhere to work. How this could have been much easier: Add 4 new methods to HtmlFormRendererBase: public void beforeFormElementsStart(FacesContext facesContext, UIComponent component) throws IOException {} public void afterFormElementsStart(FacesContext facesContext, UIComponent component) throws IOException {} public void beforeFormElementsEnd(FacesContext facesContext, UIComponent component) throws IOException {} public void afterFormElementsEnd(FacesContext facesContext, UIComponent component) throws IOException {} These methods would the be called: encodeBegin(...) { ...render the start tag... call before form elements start ...render and elements into the form call after form elements end ... encodeEnd(...) { call before form elements end ... render state, javascript etc. ... call after form elements end ... render the form end tag ... Then, with projects like AjaxAnywhere, users can extend HtmlFormRenderer and implement these methods. In these methods, we can write tags to contain this data that can be used in the AJAX code to update on every request. This would be a very simple change, would incur almost no overhead and give complete flexibility that would be needed to AJAX authors to have control over the special form behavior of JSF. I wouldn't care about the method names, in fact there could be one method with an enum argument that specifies before/after information. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira