Primefaces p:对话框中的简单p:inputText未在@namedbean中设置值
我正在使用primefaces 5.1,但仍然面临p:dialog和该对话框中的p:inputText的问题 下面是.xhtml内容Primefaces p:对话框中的简单p:inputText未在@namedbean中设置值,primefaces,dialog,Primefaces,Dialog,我正在使用primefaces 5.1,但仍然面临p:dialog和该对话框中的p:inputText的问题 下面是.xhtml内容 <ui:define name="content"> <f:metadata> <f:viewAction action="#{vLoginController.initSetup}" /> </f:metadata> <h:form id="vhome" prependId="fa
<ui:define name="content">
<f:metadata> <f:viewAction action="#{vLoginController.initSetup}" /> </f:metadata>
<h:form id="vhome" prependId="false">
<table>
<tr>
<td>
<p:commandButton value="Place Order" action="#{vLoginController.placeOrderHomePage}"
update="logindialog, signupdialog"/>
</td>
</tr>
</table>
<p:dialog id="logindialog" header="Login / Sign up" visible="#{vLoginController.loginDialog}"
draggable="false" resizable="false" modal="true">
<p:messages autoUpdate="true"/>
<h:panelGrid columns="2" cellpadding="5">
<h:outputLabel for="inuserid" value="EmailID:" />
<p:inputText id="inuserid" size="40" value="#{vLoginController.user.userId}" />
<h:outputLabel for="inpassword" value="Password:" />
<p:password id="inpassword" size="20" value="#{vLoginController.user.password}" />
<f:facet name="footer">
<p:commandButton value="Login" process="@form" action="#{vLoginController.validateLogin}" update="logindialog"/>
<p:commandButton value="Sign up" action="#{vLoginController.showSignup}" update="logindialog, signupdialog"/>
</f:facet>
</h:panelGrid>
</p:dialog>
<p:dialog id="signupdialog" header="Sign up / Login" visible="#{vLoginController.signupDialog}"
draggable="false" resizable="false" modal="true">
<p:outputLabel>Test</p:outputLabel>
</p:dialog>
</h:form>
</ui:define>
用户对象中的用户ID和密码始终为空。已经浏览了各种论坛的内容,并尝试在其周围添加outputpanel等,但都不起作用。使代码与primefaces showcase所说的非常相似,但仍然不起作用
有什么解决办法吗。。请注意,显示或隐藏对话框没有问题,这些逻辑工作正常。我只需要将用户在对话框字段中输入的值输入bean。检查嵌套表单。OT:不要使用prependId=“false”。在whyRemoved prependId=“false”上搜索Stackoverflow,它就像一个符咒,能够获取bean中的值。非常感谢。
@Named
@SessionScoped
public class VLoginController extends BaseController implements Serializable {
private VUser user;
public VLoginController() {
}
public void placeOrderHomePage() {
loginDialog = true;
signupDialog = false;
}
public String validateLogin() {
// Validate the screen fields
FacesMessage msg = new FacesMessage();
msg.setSeverity(FacesMessage.SEVERITY_ERROR);
FacesContext context = FacesContext.getCurrentInstance();
if (user.getUserId() == null || user.getPassword() == null) {
msg.setSummary("Enter User ID and Password");
context.addMessage("screenvalidation", msg);
return null;
}
}
}
public class VUser implements Serializable {
public VUser() {
}
private int userSeq;
private String userId;
private String userType;
private String password;
private String salt;
private int active;
}