Unable to Call a Backing Bean Method from JSF Page
I am unable to call backing bean method from jsf page. Can any body help ???
My JSF Page Code is
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
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"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:nib="http://sun.com/nib"
xmlns:cloud="http://java.sun.com/jsf/composite/cloud"
template="layout/layout.xhtml">
<ui:define name="title">
<h:outputText value="Patching Data Extraction"/>
</ui:define>
<ui:define name="body">
<h1>Quaterly Patch Reports</h1>
<hr/>
<h:panelGrid columns="2">
<h:form>
<ui:repeat id="paramList" value="#{patchingBean.propertyList}"
var="prop">
<h:outputLabel value="Name:"></h:outputLabel>
<h:inputText id="inputName" value="#{prop.name}"></h:inputText>
<h:outputLabel value="Value:"></h:outputLabel>
<h:inputText id="inputValue" value="#{prop.value}"/>
</ui:repeat>
<h:commandButton value ="Add" action
="#{patchingBean.addProperty}"/>
<!--<h:commandButton update="paramList" type="submit" value="Add
more" rendered="true">-->
<!--<f:ajax render="paramList"
listener="#{patchingBean.addProperty}" />-->
<!--</h:commandButton>-->
</h:form>
</h:panelGrid>
</ui:define>
And my Backing Bean Code is as
@Named("patchingBean")
@ViewScoped
public class PatchingBackingBean implements Serializable {
ObjectFactory objFactory= new ObjectFactory();
private List<Property> propertyList=null;
@PostConstruct
public void init(){
System.out.println("Creating the initial data once don't repeat");
propertyList=new ArrayList<Property>();
Property prop=objFactory.createProperty();
prop.setName(CommandParamName.PLAN.toString());
propertyList.add(prop);
System.out.println("Size of the list " + propertyList.size());
}
public List<Property> getPropertyList() {
return propertyList;
}
public void setPropertyList(List<Property> propertyList) {
this.propertyList = propertyList;
}
public String addProperty() {
System.out.println("Adding the data into the
list************************");
propertyList.add(objFactory.createProperty());
System.out.println("size of list after getting added "+
propertyList.size());
return "AddedProperty";
}
I am not getting System.out.println() of addProperty() Method on Server
Log , i.e my addProperty method is not being called when i click on Add
button .
Kindly Help....
No comments:
Post a Comment