我一直在使用下面的代码将一些详细信息输入到 mysql 表中,这工作得非常好,除了我想添加更多验证并让它看起来更专业,所以我决定为此使用 primefaces 库,而它确实提交数据,它不再将它传递给数据库,为什么这是我唯一改变的是用户输入数据的方式
这是工作原件
<h:form>
<h:messages showDetail="true" />
<h:outputText value="Enter Id : "/>
<h:inputText value="#{user.userID}"/>
<br></br>
<h:outputText value="Enter Name : " />
<h:inputText value="#{user.name}" />
<br></br>
<h:outputText value="Enter your address : "/>
<h:inputText value="#{user.address}" />
<br></br>
<h:outputText value="Enter Created Date : "/>
<h:inputText value="#{user.created_date}">
<f:convertDateTime pattern="yyyy-MM-dd"/>
</h:inputText>
<br></br>
<h:outputText value="Enter email address : "/>
<h:inputText id="email" value="#{user.email}"
size="20" required="true" label="Email Address">
<f:validator validatorId="richard.test.EmailValidator" />
</h:inputText>
<br></br>
<h:message for="email" style="color:red" />
<h:commandButton value="Insert" action="#{user.add}"/>
</h:form>
这是改进后的外观,但不再有效
<h:body>
<h:form id="form">
<p:panel id="panel" header="New Person" style="margin-bottom:10px;">
<p:messages id="messages" />
<h:panelGrid columns="3">
<h:outputLabel for="name" value="name: *" />
<p:inputText id="name"
value="#{user.name}" required="true" label="name"/>
<p:message for="name" />
<h:outputLabel for="address" value="address: *" />
<p:inputText id="address"
value="#{user.address}" required="true" label="address"/>
<p:message for="address" />
<h:outputLabel for="Id" value="Id *" />
<p:inputText id="Id"
value="#{user.userID}" required="true" label="Id"/>
<p:message for="Id" />
<h:outputLabel for="Date" value="Date *" />
<p:inputText id="Date"
value="#{user.created_date}" required="true" label="Date"/>
<p:message for="Id" />
</h:panelGrid>
</p:panel>
<p:commandButton value="Ajax Submit" update="panel,display" id="ajax"
actionListener="#{user.add}" styleClass="ui-priority-primary"/>
<!--<p:commandButton value="Non-Ajax Submit" actionListener="{user.add}"
ajax="false" />
-->
<p:panel id="display" header="Information" style="margin-top:10px;">
<h:panelGrid columns="2">
<h:outputText value="name " />
<h:outputText value="#{user.name}" />
</h:panelGrid>
</p:panel>
</h:form>
什么会导致这种情况发生?支撑豆等根本没有改变。