Ajax 操作事件仅在第二次单击commandLink/commandButton时激发
在Windows7.0上运行带有最新JRE/JDK和Glassfish 3.1的Netbeans 7.1.1 不管我构建什么类型的应用程序,出于某种原因,我必须单击任意Ajax 操作事件仅在第二次单击commandLink/commandButton时激发,ajax,jsf-2,primefaces,Ajax,Jsf 2,Primefaces,在Windows7.0上运行带有最新JRE/JDK和Glassfish 3.1的Netbeans 7.1.1 不管我构建什么类型的应用程序,出于某种原因,我必须单击任意commandLink或commandButton两次才能触发事件 这是如何造成的,我如何解决 以下是出现此问题的此类视图的示例: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transi
commandLink
或commandButton
两次才能触发事件
这是如何造成的,我如何解决
以下是出现此问题的此类视图的示例:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
<title>Time Manager - New Employee</title>
</h:head>
<h:body>
<h:form id="form"">
<p:panel id="panel" header="New Employee">
<p:messages id="msgs"/>
<h:panelGrid columns="3">
<h:outputLabel for="fname" value="Firstname: *" />
<p:inputText id="fname" value="#{employee.name}"
required="true" label="FullName">
<f:validateLength minimum="2" maximum="20" />
</p:inputText>
<p:message for="fname" display="icon"/>
<h:outputLabel for="eml" value="Email: *" />
<p:inputText id="eml" value="#{employee.email}"
label="Email" required="true">
<f:validateLength minimum="9" maximum="100" />
<p:ajax update="msgEml" event="keyup" />
</p:inputText>
<p:message for="eml" id="msgEml" display="icon"/>
</h:panelGrid>
<p:button id="btn" value="Cancel" update="panel"
type="button" outcome="/index"/>
<p:commandButton id="addEmp" value="Save" update="panel"
actionListener="#{employee.saveEmployee}"
styleClass="ui-priority-primary"/>
</p:panel>
</h:form>
</h:body>
</html>
时间经理-新员工
(评论被吞没了)事实发生之后,我知道。尝试向您的侦听器添加javax.faces.event.ActionEvent,这可能对我有所帮助。