Jsf 2 从ManageBean中的jsf inputText获取空值
我在jsf inputText中遇到了奇怪的问题。在浏览器上,它在输入框中显示管理bean名称和变量名称(即#{loginModel.userName})。下面是我的jsf页面代码Jsf 2 从ManageBean中的jsf inputText获取空值,jsf-2,Jsf 2,我在jsf inputText中遇到了奇怪的问题。在浏览器上,它在输入框中显示管理bean名称和变量名称(即#{loginModel.userName})。下面是我的jsf页面代码 <body> <f:view> <h:form> <h:outputLabel value="Username"></h:outputLabel> <h:inputText value="#{loginModel
<body>
<f:view>
<h:form>
<h:outputLabel value="Username"></h:outputLabel>
<h:inputText value="#{loginModel.userName}"></h:inputText>
<h:outputLabel value="Password"></h:outputLabel>
<h:inputSecret value="#{loginModel.password}"></h:inputSecret>
<h:commandButton value="Submit" action="#{loginModel.process}" ></h:commandButton>
</h:form>
</f:view>
</body>
和我的faces-config.xml文件
<managed-bean>
<managed-bean-name>loginModel</managed-bean-name>
<managed-bean-class>net.varun.dto.LoginModel</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
登录模型
net.varun.dto.LoginModel
一场
下面是我在浏览器上的输出,当我单击submit按钮时,我的输出为空。请尝试以下代码: 更改primefaces进程的h:commandButton、
partialSubmit
和ajax
<body>
<f:view>
<h:form>
<h:outputLabel value="Username"></h:outputLabel>
<h:inputText value="#{loginModel.userName}"></h:inputText>
<h:outputLabel value="Password"></h:outputLabel>
<h:inputSecret value="#{loginModel.password}"></h:inputSecret>
<p:commandButton value="Submit" action="#{loginModel.process}" process="@form" partialSubmit="true" ajax="true" />
</h:form>
</f:view>
</body>
因此,您可以在流程方法中设置断点,以查看更新值
<body>
<f:view>
<h:form>
<h:outputLabel value="Username"></h:outputLabel>
<h:inputText value="#{loginModel.userName}"></h:inputText>
<h:outputLabel value="Password"></h:outputLabel>
<h:inputSecret value="#{loginModel.password}"></h:inputSecret>
<p:commandButton value="Submit" action="#{loginModel.process}" process="@form" partialSubmit="true" ajax="true" />
</h:form>
</f:view>
</body>