Jsp 未定义PrimeFaces 4.0 PF
我正在尝试使用PrimeFaces4.0实现进度条 我在官方网站上也有这样的例子: 但是,在我复制粘贴代码并运行它之后 萤火虫告诉我了 “未定义PF。” 请在下面找到我的代码:Jsp 未定义PrimeFaces 4.0 PF,jsp,primefaces,progress-bar,Jsp,Primefaces,Progress Bar,我正在尝试使用PrimeFaces4.0实现进度条 我在官方网站上也有这样的例子: 但是,在我复制粘贴代码并运行它之后 萤火虫告诉我了 “未定义PF。” 请在下面找到我的代码: <h:form> <p:growl id="growl" /> <h3>Client Side ProgressBar</h3> <p:commandButton value="Start"
<h:form>
<p:growl id="growl" />
<h3>Client Side ProgressBar</h3>
<p:commandButton value="Start" id="start" type="button"
onclick="start()" widgetVar="startButton1" />
<p:commandButton value="Cancel" id="cancel" type="button"
onclick="cancel()" />
<p:progressBar id="progressBarClient" widgetVar="pbClient"
style="width:300px" />
</h:form>
客户端进度条
下面是我的Java脚本:
<script type="text/javascript">
function start() {
PF('startButton1').disable();
window['progress'] = setInterval(function() {
var pbClient = PF('pbClient'),
oldValue = pbClient.getValue(),
newValue = oldValue + 10;
pbClient.setValue(pbClient.getValue() + 10);
if(newValue === 100) {
clearInterval(window['progress']);
}
}, 1000);
}
function cancel() {
clearInterval(window['progress']);
PF('pbClient').setValue(0);
PF('startButton1').enable();
}
函数start(){
PF('startButton1').disable();
窗口['progress']=setInterval(函数(){
var pbClient=PF('pbClient'),
oldValue=pbClient.getValue(),
新值=旧值+10;
pbClient.setValue(pbClient.getValue()+10);
如果(新值===100){
clearInterval(窗口['progress']);
}
}, 1000);
}
函数cancel(){
clearInterval(窗口['progress']);
PF('pbClient')。设置值(0);
PF('startButton1').enable();
}
这些基本上都是从官方网站示例中复制的。尝试类似的方法:
<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:p="http://primefaces.org/ui">
<f:view contentType="text/html">
<h:head>
<f:facet name="first">
<meta content='text/html; charset=UTF-8' http-equiv="Content-Type"/>
<title>Title</title>
</f:facet>
</h:head>
<h:body>
<h:form>
<p:growl id="growl" />
<h3>Client Side ProgressBar</h3>
<p:commandButton value="Start" id="start" type="button"
onclick="start()" widgetVar="startButton1" />
<p:commandButton value="Cancel" id="cancel" type="button"
onclick="cancel()" />
<p:progressBar id="progressBarClient" widgetVar="pbClient"
style="width:300px" />
</h:form>
<script type="text/javascript">
function start() {
PF('startButton1').disable();
window['progress'] = setInterval(function() {
var pbClient = PF('pbClient'),
oldValue = pbClient.getValue(),
newValue = oldValue + 10;
pbClient.setValue(pbClient.getValue() + 10);
if (newValue === 100) {
clearInterval(window['progress']);
}
}, 1000);
}
function cancel() {
clearInterval(window['progress']);
PF('pbClient').setValue(0);
PF('startButton1').enable();
}
</script>
</h:body>
</f:view>
</html>
标题
客户端进度条
函数start(){
PF('startButton1').disable();
窗口['progress']=setInterval(函数(){
var pbClient=PF('pbClient'),
oldValue=pbClient.getValue(),
新值=旧值+10;
pbClient.setValue(pbClient.getValue()+10);
如果(新值===100){
clearInterval(窗口['progress']);
}
}, 1000);
}
函数cancel(){
clearInterval(窗口['progress']);
PF('pbClient')。设置值(0);
PF('startButton1').enable();
}
您的xhtml中有吗?这应该是您的xhtml格式//code//code
我使用了和标记,但运气不好,谢谢您的帮助。谢谢@Daniel Camargo,我的页面格式与您建议的格式相同,但我仍然运气不佳。Firebug不报告PF未定义错误,但进度条和命令按钮未显示。