f:commandButton and immediate attribute
I have a form with two fields. A field for street that should not be null and
a select box with two values that based on the chosen language the page gets values from two properties files.I would like the user when selects something from the select box to get the values from the properties file without validation for the first field.So I read that I should do 2 things.First I have to add the attributeimmediate in the componentselectOneMenu and then in the listener that is calls to add the following line
context.renderResponse()
.
The complete code of my jsp is:
<html>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix ="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix ="h"%>
<f:view>
<head>
<f:loadBundle basename="bundle.messages" var="msgs"/>
</head>
<body>
<h:form>
<h:panelGrid columns="3">
<h:outputText value="#{msgs.streetAddressPrompt}"/>
<h:inputText value="#{form.streetAddress}" id="streetAddress" required="true"/>
<h:message for="streetAddress"/>
<h:outputText value="#{msgs.countryPrompt}"/>
<h:selectOneMenu value="#{form.country}"
onchange="submit()">
<f:valueChangeListener type="com.corejsf.events.CountryListener"/>
<f:selectItems value="#{form.countryNames}"/>
</h:selectOneMenu>
</h:panelGrid>
<p/>
<h:commandButton value="#{msgs.submit}"/>
</h:form>
</body>
</f:view>
</html>
I read that context.renderResponse() skips validation.So if it does what why do I need the attributeimmediate which I understand that what it does is that fires the action event before validation.

