当窗体处于可编辑模式时,我需要在primefaces数据表中包含inputTexts.
一切正常,除了使用immediate ="true"进行清理(没有表单验证).然后,primefaces数据表的行为是不可预测的.在使用新数据填充数据表后 - 它仍然存储旧值.
简短示例 - 显示h:dataTable和p:dataTable之间的差异 - 但是当示例中只有三个表中的一个时,它的工作方式相同:test.xhtml
<h:body>
<h:form id="form">
<p:dataTable var="v" value="#{test.list}" id="testTable">
<p:column headerText="Test value">
<p:inputText value="#{v}"/>
</p:column>
</p:dataTable>
<h:dataTable var="v" value="#{test.list}" id="testTable1">
<h:column>
<f:facet name="header">
<h:outputText value="Test value" />
</f:facet>
<p:inputText value="#{v}" />
</h:column>
</h:dataTable>
<p:dataTable var="v" value="#{test.list}" id="testTable2">
<p:column headerText="Test value">
<h:outputText value="#{v}" />
</p:column>
</p:dataTable>
<p:commandButton value="Clear" actionListener="#{test.clear()}" immediate="true" update=":form:testTable :form:testTable1 :form:testTable2"/>
<p:commandButton value="Update" actionListener="#{test.update()}" update=":form:testTable :form:testTable1 :form:testTable2"/>
</h:form>
</h:body>
Run Code Online (Sandbox Code Playgroud)
和java:
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.bean.ViewScoped; …Run Code Online (Sandbox Code Playgroud) 我正在使用Primefaces 3.4.2和JSF2.1我创建了一个分为一些布局单元的页面.在右侧布局单元中,我有一个accordionPanel并创建了动态菜单,中间中心布局由ui:include和一个页面加载在图层中,当我点击链接时打开一个包含动态页面的对话框.打开和关闭对话框而不在正确的布局中执行任何操作后,中间中心布局不再起作用.我可以看到它,但我点击输入文本我不能输入任何东西也点击其他组件没有任何反应!什么是问题?有解决方案吗?
当单击菜单项打开对话框包含其他页面并单击树节点中心布局更改时,在对话框中打开的页面工作正常,但是当关闭对话框,中心布局按钮和输入不起作用时,其他布局组件运行良好!
我的新代码:
<p:layoutUnit id="right" position="east" size="145" style="text-align:center;direction: ltr!important;padding: 0px!important;">
<h:form prependId="false">
<script type="text/javascript">
function test(id,url,title){
document.getElementById('h1').value=id;
document.getElementById('h2').value=url;
document.getElementById('h3').value=title;
salamm.jq.click();
}
</script>
<h:inputHidden id="h1" value="#{adminC.nclose}" />
<h:inputHidden id="h2" value="#{adminC.nurl}"/>
<h:inputHidden id="h3" value="#{adminC.ntitle}"/>
<p:commandButton actionListener="#{adminC.addTab()}" id="salam" widgetVar="salamm" update=":dlgpanel" onstart="waitDialogmain.show()" style="display: none" oncomplete="waitDialogmain.hide();dlg1.show()"/>
<p:accordionPanel style="text-align: center;font-family: tahoma!important" activeIndex="#{menuGen.activeIndex}">
<p:tab title="connections" id="t0" rendered="#{menuGen.menuList1.length()>0}" >
<center>
<h:outputText escape="false" value="#{menuGen.menuList1}"/>
</center>
<br/>
</p:tab>
<p:tab title="manage" id="t1" rendered="#{menuGen.menuList2.length()>0}" >
<center>
<h:outputText value="#{menuGen.menuList2}" escape="false"/>
</center>
<br/>
</p:tab>
</p:accordionPanel>
</h:form>
</p:layoutUnit>
<p:layoutUnit id="center" style="padding: 0px!important;" position="center">
<p:layout …Run Code Online (Sandbox Code Playgroud) 我有一个h:inputText,h:selectonemenu和commandbuton.Inputtext是必填字段,我将其定义为immediate ="true".然后,当我单击按钮时,我想将selectonemenu的当前值传递给托管bean.但它的passig null.如何管理此验证,以便我可以在托管bean中获取selectOneMenu的值.
我的代码是......
<h:inputText id="inputSome" required="true" requiredMessage="Pls enter something"/>
<h:message for="inputSome"></h:message>
<h:selectOneMenu id="recepients" value="#{controller.selected}" immediate="true">
<f:selectItem itemLabel="Select" itemValue=""/>
<f:selectItems value="#{controller.tempNameList1}"></f:selectItems>
</h:selectOneMenu>
<p:commandButton value="Add" action="#{controller.submit}"
immediate="true"/>
Run Code Online (Sandbox Code Playgroud) 我有一个要求,用户应该能够从日历中选择日期.我使用过<p:calendar>PrimeFaces.
<p:calendar value="#{calendarBean.date1}" pattern="MM/dd/yyyy HH:mm" />
Run Code Online (Sandbox Code Playgroud)
问题是用户不应该选择分钟.他应该只能选择几个小时.
我怎样才能将一个arugument传递给听众方法?
我试过这样的:
<p:poll interval="3" listener="#{vehicleController.onPoll('12')}"
update="vehicleDataList"/>
Run Code Online (Sandbox Code Playgroud)
和
<p:poll interval="3" listener="#{vehicleController.onPoll(vehicle.vehicleLicense)}"
update="vehicleDataList"/>
Run Code Online (Sandbox Code Playgroud)
但它抛出以下异常:
javax.servlet.ServletException: /monitorVehicles/vehiclesList.xhtml
Failed to parse the expression [#{vehicleController.onPoll('12')}]
Run Code Online (Sandbox Code Playgroud)
我怎么能得到这个?
嗨,我已经花了好几个小时,我希望使用Primefaces请求上下文以JSON格式发送我的POJO到我的JSF中的Highchart来更新它的值.基本上我从他自己的stackoverflow 问题中遵循@Bhesh Gurung的这个解决方案, 但我似乎无法让它工作.现在它扔了一个:
找不到具有从"j_idt31"引用的标识符"pieData"的组件.
我想通过Primefaces Request Context使用JSON数据成功创建一个高清图.请提前帮助,谢谢.
这是我的代码如下
@ManagedBean
@ViewScoped
public class PieDataProvider {
public void retrievePieData() {
List<String> categories = new ArrayList<String>();
categories.add("Electronic");
categories.add("Food");
categories.add("Liguor");
categories.add("Stationary");
categories.add("Mechanical");
List<Integer> itemCounts = new ArrayList<Integer>();
itemCounts.add(5);
itemCounts.add(20);
itemCounts.add(1);
itemCounts.add(50);
itemCounts.add(10);
RequestContext reqCtx = RequestContext.getCurrentInstance();
reqCtx.addCallbackParam("categories", new Gson().toJson(categories));
reqCtx.addCallbackParam("itemCounts", new Gson().toJson(itemCounts));
System.out.println(categories);
}
}
Run Code Online (Sandbox Code Playgroud)
我的xhtml page5.xhtml
<?xml version="1.0" encoding="UTF-8"?>
Run Code Online (Sandbox Code Playgroud)
<ui:composition template="/template/common/commonLayout.xhtml">
<ui:define name="content">
<h:head>
<script type="text/javascript">
src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"
src="http://code.highcharts.com/highcharts.js"
src="http://code.highcharts.com/modules/exporting.js"
</script>
<script type="text/javascript">
function feedPieData(xhr, status, args) {
var categories = eval('(' …Run Code Online (Sandbox Code Playgroud) 我有这个:
<p:treeTable id="#{treeTableId}" value="#{tableBeanRoot}" var="element"
resizableColumns="true"
selection="#{budgetTemplateElementBean.selectedNode}"
selectionMode="single" widgetVar="#{treeTableId}widget">
<f:facet name="header">
</f:facet>
<p:column style="width:150px">
.....
</p:column>
.....
<f:facet name="footer">
<p:commandButton value="#{msg.addChildNode}"
actionListener="#{actionBean.addChildNodeAction}"
process="@this,#{treeTableId}" update="#{treeTableId} :growl" />
<p:commandButton value="#{msg.deleteNode}"
actionListener="#{actionBean.deleteNodeAction}"
process="@this,#{treeTableId}" update="#{treeTableId} :growl" />
</f:facet>
</p:treeTable>
Run Code Online (Sandbox Code Playgroud)
如何在Primefaces treeTable中添加和删除treeNodes?我可以把什么东西放回去?
谢谢
我正在尝试使用Primefaces布局,但我得到以下错误.我搜索了这个错误,但我没有在互联网上看到太多帮助.
UI布局初始化错误
中心窗格元素不存在.
中心窗格是必需元素
什么是中心窗格?
下面是我在xhtml文件中的代码.
<p:layout >
<p:layoutUnit position="north" >
<h:outputText value="North unit content." />
</p:layoutUnit>
</p:layout>
Run Code Online (Sandbox Code Playgroud)
这是怎么造成的,我该如何解决?
我想添加动态输入字段.喜欢

PF关于如何添加这样的组件有一个很好的组成部分吗?
请给我一个关于如何开发它的提示,因为我现在还没有任何线索.
我非常感谢你的回答.
我的技术堆栈:
我在我的jsf页面中有一个日历,我希望得到他的价值,当它改变我试图添加监听器但没有工作我发现其他解决方案,但没有使用primefaces 3.5:
<p:calendar id="popupButtonCal22" value="#{zp01ManagedBean.datedeplanification}" showOn="button" locale="fr" >
<p:ajax listener="#{zp01ManagedBean.setDatedeplanification(zp01ManagedBean.datedeplanification)}"/>
</p:calendar>
Run Code Online (Sandbox Code Playgroud)
你知道如何解决这个问题吗?
我正在使用primefaces 3.5
primefaces ×10
jsf ×8
jsf-2 ×2
ajax ×1
arguments ×1
calendar ×1
el ×1
highcharts ×1
java ×1
javascript ×1
json ×1
layout ×1
listener ×1
validation ×1