0
我正在將應用程序從icefaces 1.8遷移到icefaces 3.2。這是一個複雜的應用程序,我在我們有類似的頁面具有JSF 2輸入onkeyup無法在jsf2中工作
登錄頁面問題:
<script type="text/javascript">
function onEnter(ev)
{ if(ev==13)
{
document.getElementById('login:linkLogin').onclick();
}
}
</script>
.
.
.
<body onkeyup="onEnter(event.keyCode);">
.
.
.
<ice:commandLink id="linkLogin" action="#{loginBean.auth}" onclick=";encriptPass('#{login.rsaKeyMod}','#{login.rsaPubKey}');">
.
.
.
這適用於JSF 1.2 + 1.8 ICEfaces的問題withou。 但在JSF 2.1 + 3.2 ICEfaces的我修改的代碼是這樣的:
<script type="text/javascript">
function onEnter(ev)
{ if(ev==13)
{
document.getElementById('login:linkLogin').onclick();
}
}
</script>
.
.
.
<h:body onkeyup="onEnter(event.keyCode);">
.
.
.
<ice:commandLink id="linkLogin" action="#{loginBean.auth}" onclick=";encriptPass('#{login.rsaKeyMod}','#{login.rsaPubKey}');">
.
.
.
此代碼不會以這種方式工作。如果我按回車鍵,表單會重置並且bean.auth方法甚至不會被調用。
我在這裏錯過了什麼。 JS在jsf2中的表現有何不同?
編輯: 我發現在這個線程的解決方案: Submit action by the enter key 最後的後有解決方法。
我沒有在形式的提交按鈕。通過linkLogin操作方法LoginBean.auth(ActionEvent e)完成身份驗證。 – panietoar