I have a simple input form that accepts data from the user and stores the data in DB upon a click action for a p:commandButton
the form looks like this
form.xhtml :
<div align="center" style="width: 80%">
<p:panelGrid columns="1">
<p:accordionPanel>
<p:tab title="#{msg['truck.tab.general']}">
<h:form><h:panelGrid columns="3">
<p:outputLabel value="*#{msg['truck.form.code']}"></p:outputLabel>
<p:inputText id="inputTruckCode" required="true"
requiredMessage="Must exist"
value="#{trucksBean.currentTruck.code}"></p:inputText>
<p:message for="inputTruckCode" showSummary="true"></p:message>
<!-- rest of the form -->
</h:form>
</p:tab>
</p:accordionPanel>
<p:commandButton action="#{trucksBean.insertTruck}"
value="Insert Truck"></p:commandButton>
</p:panelGrid>
</div>
the backing bean code:
@ManagedBean
@ViewScoped
public class TrucksBean {
private TruckFullInformation currentTruck;
public String insertTruck() {
//the values inside currentTruck member variable are NULLs
return null;
}
what's wrong with the code? why clicking on the commandButton doesn't affect/update the values of the "currentTruck" variable?
thanks in advance;