How to produce javax.faces.ViewState hidden field without 'id' and 'autocomplete' attributes

yegor256 picture yegor256 · Mar 1, 2011 · Viewed 7.4k times · Source

This is what I have in the output HTML document (produced by JSF 2.0/Mojarra 2.0.3):

<input type="hidden" name="javax.faces.ViewState" 
id="javax.faces.ViewState" value="4267906931114993858:-6309146738430577631"
autocomplete="off" />

My document should be XHTML 1.1 compliant, where attribute autocomplete is not valid and id attribute is duplicated over all forms. How to instruct JSF to produce everything strictly compliant to XHTML?

Answer

frekele picture frekele · Jan 20, 2012

See.

 <context-param>
   <param-name>com.sun.faces.autoCompleteOffOnViewState</param-name>
   <param-value>false</param-value>
 </context-param>

 <context-param>
   <param-name>com.sun.faces.enableViewStateIdRendering</param-name>
   <param-value>false</param-value>
 </context-param>