gpt4 book ai didi

java - Primefaces-表单提交后文本框项目不会消失

转载 作者:行者123 更新时间:2023-12-01 15:37:59 24 4
gpt4 key购买 nike

我正在使用 JSF Primefaces 3.0.M3。当我提交(保存)表单时,文本框中的某些项目也不会消失。给出的是代码-用户名和密码在表单提交后仍然存在。您能提出任何问题吗?

<h:form id="formId" prependId="false">
<p:wizard flowListener="#{employeeRepositoryImpl.handleFlow}"
showNavBar="true" widgetVar="scheduler" showStepStatus="false">
<p:tab id="personal">
<p:panel header="Login Credentials">
<!-- <p:messages showDetail="true" autoUpdate="true"/> -->
<h:panelGrid columns="3" autoUpdate="false">

<h:outputText value="First Name*" />
<p:inputText
value="#{employeeRepositoryImpl.employee.firstName}"
required="true" label="First Name" id="firstName"
validatorMessage="Invalid First Name"
onblur="changeCase(this)">
<f:validateRegex
pattern="^[a-zA-Z]+(([\'\,\.\- ][a-zA-Z ])?[a-zA-Z]*)*$" />
<p:ajax event="blur" update="firstName" />
</p:inputText>
<p:message id="msg4" for="firstName" />

<h:outputText value="Middle Name" />
<p:inputText
value="#{employeeRepositoryImpl.employee.middleName}"
label="Middle Name" id="middleName" onblur="changeCase(this)" />
<p:message id="msg5" for="middleName" />

<h:outputText value="Last Name*" />
<p:inputText
value="#{employeeRepositoryImpl.employee.lastName}"
required="true" label="Last Name" id="lastName"
validatorMessage="Invalid Last Name"onblur="changeCase(this)">
<f:validateRegex pattern="^[A-Z][a-zA-Z]*$" />
<p:ajax event="blur" update="lastName" />

</p:inputText>
<p:message id="msg6" for="lastName" />

<h:outputText value="Employee Code*" />
<p:inputText
value="#{employeeRepositoryImpl.employee.employeeCode}"
required="true" label="Employee Code" id="employeeCode">
<p:ajax event="blur" update="employeeCode" />
</p:inputText>
<p:message id="msg7" for="employeeCode" />

<h:outputText value="User Name*" />
<p:inputText
value="#{employeeRepositoryImpl.securityPrincipals.userName}"
required="true" label="User Name" id="userName"
validatorMessage="Invalid Email ID">

<f:validateRegex
pattern="^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$" />

<p:ajax event="blur" update="userName" />
</p:inputText>
<p:message id="userNameId" for="userName"/>

<h:outputText value="Password*" />
<p:password
value="#{employeeRepositoryImpl.securityPrincipals.password}"
match="confirmPassword" required="true" label="Password"
id="password" for="password">
<p:ajax listener="#{employeeRepositoryImpl.handlePW}"
update="password" />
</p:password>
<p:message id="msg8" for="password" />

<h:outputText value="Confirm Password*" for="confirmPassword" />
<p:password
value="#{employeeRepositoryImpl.securityPrincipals.confirmPassword}"
required="true" label="Confirm Password" id="confirmPassword"
onkeyup="checkPass(); return false;">
<p:ajax listener="#{employeeRepositoryImpl.handlePW}"
update="confirmPassword" />
</p:password>
<p:message id="msg" for="confirmPassword" display="text" />

</h:panelGrid>
</p:panel>
</p:tab>
</p:wizard
<h:commandButton value="Submit"
actionListener="#{employeeRepositoryImpl.save}" immediate="true">
</h:commandButton>

</h:form>

即使提交表单后,输入的用户名、密码、确认密码也不会消失。附件是屏幕截图enter image description here表单提交后。

最佳答案

那么,您是否尝试过在提交后重置所有字段?将它们插入数据库后,尝试将它们重新初始化为 0/null。

此外,如果您在浏览器自动完成表单方面遇到问题,请参阅 inputText 标记的 Primefaces autocomplete 属性。请阅读Primefaces User Guide .

关于java - Primefaces-表单提交后文本框项目不会消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8571143/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com