我是JSF和PrimeFaces的新手。我希望在我的JSF项目的登录页面中使用屏幕键盘,我找到了primefaces键盘。当我按下primefaces键盘中的enter按钮时,它不起作用。
即使我添加了onkeypress="if (event.keyCode == 13) #{usersBean.login()};"
我尝试添加<h:form>
和<p:keyboard>
。它只能用于按下物理输入按钮,而不能按下主要键盘中的按钮。
以下是使用primefaces键盘的登录页面示例:
<f:view>
<h:form id="loginForm" onkeypress="if (event.keyCode == 13) #{usersBean.login()};">
<h2><h:outputText value="User Login"/></h2>
<h:panelGrid columns="2" style=" padding-top: 20px">
<h:outputLabel value="Email / ID:" for="userIdEmail" />
<h:inputText id="userIdEmail" value="#{usersBean.userIdEmail}" title="Email / ID" required="true" requiredMessage="The Email / ID field is required." style="width: 200px"/>
<h:outputLabel value="Password:" for="userPassword" />
<p:keyboard id="userPassword" value="#{usersBean.loginPassword}" title="UserPassword" showMode="button" password="true" style="width: 195px" />
</h:panelGrid>
<div>
<h:commandButton id="loginButton" value="Login" action="#{usersBean.login()}" binding="#{usersBean.loginButton}" style="margin-right: 5px"/>
<h:message for="loginButton" styleClass="errorStyle" style="text-align: center"/>
</div>
</h:form>
</f:view>
在按下primefaces键盘中的enter按钮后,任何人都知道如何继续登录方法?