I have a problem again with JSF. I am still learning and your help is much apreciated.
<h:form>
<h:selectOneMenu value="#{productBean.productName}">
<f:selectItems value="#{productBean.pizza}" var="pizza" itemValue="#{pizza}" itemLabel="#{pizza.name}" />
<f:ajax listener="#{productBean.valueChanged(pizza)}" render="pizzaResult" />
</h:selectOneMenu>
<h:commandButton value ="Dodaj do zamówienia"/>
<h:outputText id="pizzaResult" value="#{productBean.message}" />
</h:form>
I just want to call the metod valueChanged with the parameter of custom object: Product. This is the method:
public void valueChanged(Product prod)
{
if(prod.getIs_available() == 1)
message = "yes";
else
message = "no";
}
I want it to verify if the product is available. And print it in an outputText tag. I think the problem is in HTML because all data reqested are Strings, and I cannot send an Product in such way. Should I use a converter? How it should look like? I don't know much about converters and the working example of ProductConverter will clear my mind. THanks in advance.