JSF 2.
A simple form with a single input that is validated. Using o:form in an attempt to fix the problem.
<f:view>
<f:metadata>
<f:viewParam name="info2" value="#{myClass.info2}" />
<f:viewParam name="info1" value="#{myClass.info1}" />
<f:event listener="#{myClass.init(}" type="preRenderView" />
</f:metadata>
<o:form includeViewParams="true">
<h:outputText value="Enter some info for #{myClass.info1}" />
<h:inputText id="input" value="#{myClass.info3}"
validator="myValidator" />
<br />
<h:commandButton action="#{myClass.action()}" value="Enter some info" />
<br />
<h:message for="input" />
<br />
<h:outputText value="#{myClass.info2}" />
</o:form>
</f:view>
Called with this URL
http://localhost:8080/test/test.xhtml?info1=hello&info2=there
When I put a value in the input field and the validation fails, the page comes back with the same URL, but with both myClass.info1 and myClass.info2 set to null. It's great that the URL is preserved, but it doesn't do much good if those parameters arent' being set in the bean.
Why is that and how do I fix it?