jsf输入按键问题 [英] jsf enter key pressed problem
问题描述
我有一个带有两个按钮的xhtml弹出页面.这两个按钮在其后备bean中都有actionListener方法.当用户单击Enter时,我如何确保第一个按钮actionListener方法被调用.
i have a xhtml popup page which has two buttons.The two buttons have actionListener methods in their backing beans. When the user clicks enter how can i ensure that the first buttons actionListener method gets called.
推荐答案
几个框架都提供了一个标签来允许这样做,例如,
Several frameworks provide a tag to allow for this, for example <s:defaultAction/>
from Jboss Seam. It is just adds a piece of javascript to your page that listens for the enter key.
如果您不使用Seam或类似产品,则可以自己添加javascript-例如
If you aren't using Seam or similar, then add the javascript yourself - for example something like this
这篇关于jsf输入按键问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!