你好我正在测试官方primefaces网站上给出的例子,我注意到我的<p:commandButton>
效果不好,一旦我点击它来更新一个值,它会保持突出显示,不能再次点击再次更新该值。这是xhtml文件:
<?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:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui">
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<h:head>
</h:head>
<h:form>
<h:panelGrid columns="2" cellpadding="5" styleClass="ui-grid">
<h:outputLabel for="basic" value="Basic Spinner: " />
<p:spinner id="basic" value="#{spinnerView.number1}" />
<h:outputLabel for="step" value="Step Factor: " />
<p:spinner id="step" value="#{spinnerView.number2}" stepFactor="0.25" />
<h:outputLabel for="minMax" value="Min/Max: " />
<p:spinner id="minMax" value="#{spinnerView.number3}" min="0" max="100" />
<h:outputLabel for="prefix" value="Prefix: " />
<p:spinner id="prefix" value="#{spinnerView.number4}" prefix="$" min="0" />
<h:outputLabel for="ajaxSpinner" value="Ajax Spinner: " />
<p:outputPanel>
<p:spinner id="ajaxSpinner" value="#{spinnerView.number5}">
<p:ajax update="ajaxSpinnerValue" process="@this" />
</p:spinner>
<h:outputText id="ajaxSpinnerValue" value="#{spinnerView.number5}" style="padding-left: 10px" />
</p:outputPanel>
</h:panelGrid>
<p:commandButton value="Submit" update="display" oncomplete="PF('dlg').show()" />
<p:dialog header="Values" widgetVar="dlg" showEffect="fold" hideEffect="fold">
<h:panelGrid id="display" columns="2" cellpadding="5">
<h:outputText value="Value 1: " />
<h:outputText value="#{spinnerView.number1}" />
<h:outputText value="Value 2: " />
<h:outputText value="#{spinnerView.number2}" />
<h:outputText value="Value 3: " />
<h:outputText value="#{spinnerView.number3}" />
<h:outputText value="Value 4: " />
<h:outputText value="#{spinnerView.number4}" />
<h:outputText value="Value 5: " />
<h:outputText value="#{spinnerView.number5}" />
</h:panelGrid>
</p:dialog>
</h:form>
</html>
这是托管bean:
package uk.soton.lostatnight;
import javax.faces.bean.ManagedBean;
@ManagedBean
public class SpinnerView {
private int number1;
private double number2;
private int number3;
private int number4;
private int number5;
public int getNumber1() {
return number1;
}
public void setNumber1(int number1) {
this.number1 = number1;
}
public double getNumber2() {
return number2;
}
public void setNumber2(double number2) {
this.number2 = number2;
}
public int getNumber3() {
return number3;
}
public void setNumber3(int number3) {
this.number3 = number3;
}
public int getNumber4() {
return number4;
}
public void setNumber4(int number4) {
this.number4 = number4;
}
public int getNumber5() {
return number5;
}
public void setNumber5(int number5) {
this.number5 = number5;
}
}
我发现这很奇怪,所以有没有人有这个问题的任何解决方案,或者它是其他东西的原因,如web或pom.xml文件,如果是这样,我该如何解决这个问题?