You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Manfred Geiler (JIRA)" <de...@myfaces.apache.org> on 2007/11/19 17:43:43 UTC

[jira] Issue Comment Edited: (MYFACES-1700) each generated an with same id="javax.faces.ViewState"

    [ https://issues.apache.org/jira/browse/MYFACES-1700?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543599 ] 

manolito edited comment on MYFACES-1700 at 11/19/07 8:43 AM:
-------------------------------------------------------------------

This is a spec bug in JSF 1.2:
http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/render/ResponseStateManager.html#VIEW_STATE_PARAM

However, the id is actually not needed (in MyFaces) unless some special (AJAX) components wanna do some Javascript magic.

Therefore I added a (MyFaces specific) config parameter:
  org.apache.myfaces.RENDER_VIEWSTATE_ID
The default value is true for backwards compatibility.

So, adding
    <context-param>
        <description>
            Do not render the "javax.jsf.ViewState" id attribute for
            view state hidden inputs. Necessary for valid XHTML on multiple forms on one page.
        </description>
        <param-name>org.apache.myfaces.RENDER_VIEWSTATE_ID</param-name>
        <param-value>false</param-value>
    </context-param>
to your web.xml makes multiple form jsf pages XHTML valid.

--Manfred


      was (Author: manolito):
    This is a spec bug in JSF 1.2:
http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/render/ResponseStateManager.html#VIEW_STATE_PARAM

However, the id is actually not needed (in MyFaces) unless some special (AJAX) components wanna do some Javascript magic.

Therefore I added a (MyFaces specific) config parameter:
  org.apache.myfaces.RENDER_VIEWSTATE_ID
The default value is false for backwards compatibility.

So, adding
    <context-param>
        <description>
            Do not render the "javax.jsf.ViewState" id attribute for
            view state hidden inputs. Necessary for valid XHTML on multiple forms on one page.
        </description>
        <param-name>org.apache.myfaces.RENDER_VIEWSTATE_ID</param-name>
        <param-value>false</param-value>
    </context-param>
to your web.xml makes multiple form jsf pages XHTML valid.

--Manfred

  
> each <h:form> generated an <input> with same id="javax.faces.ViewState" 
> ------------------------------------------------------------------------
>
>                 Key: MYFACES-1700
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1700
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.5
>         Environment: I am using Tomcat 5.5. inside of JBoss 4.0.2.
>            Reporter: Marcus Beyer
>            Assignee: Manfred Geiler
>             Fix For:  1.1.6-SNAPSHOT
>
>
> On pages with more than one <h:form>, each one generates an element which has always the same id, which is invalid HTML. 
> Looks like this:
> ...</script><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="..." /></form>
> I tried to put it inside <f:subview> as a workaround, but that did not work either (the ids did not change).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.