Partial submit , Immediate and JSF Life cycle Issue
Hi ,
I have a form with a input text field and a submit button. The value attribute of the input field (*private String name*)
is a backing bean property and it is binded to a RichInputText property *(private RichInputText nameField;)*
in the same backing bean.The submit button has an action listener which calls a method in my backing bean*(displayText(ActionEvent ae*)
). The submit button has the partial submit attribute set to "true" and immediate set to "true" .With immediate set to "true" my understanding is that, jsf life cycle sets "apply request values" and then skips the validation ,model updation directly goes to invoke application phase.With this assumption , on invoke application, setNameField(RichInputText nameField) will be called called (apply request values) and i should be able to get the value using the getLocalValue() method on the RichInputText
class.But when i try to display it in my managed bean ,it is null.
How can i access the input value in my backing bean when both the partial submit and immediate attruibtes are set to true on my submit button?
Here is my backing bean class :
public class SampleBean {
private RichInputText nameField;
public SampleBean() {
}
private String name;
public void setName(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void setNameField(RichInputText nameField) {
this.nameField = nameField;
}
public RichInputText getNameField() {
return nameField;
}
public void displayText(ActionEvent ae){
System.out.println(nameField.getLocalValue());
//System.out.println(name);
}
}
jsf page :
<?xml version='1.0' encoding='windows-1252'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=windows-1252"/>
<f:view>
<af:document>
<af:form>
<af:inputText label="Label 1" value="#{ sampleBean.name}"
binding="#{sampleBean.nameField}"/>
<af:commandButton text="Submit" id="submit" partialSubmit="true"
immediate="true"
actionListener="#{sampleBean.displayText}"/>
<af:outputText value="#{sampleBean.name}" partialTriggers="submit"/>
</af:form>
</af:document>
</f:view>
</jsp:root>