Jsf p:对话框无法填充值
已经对设置bean中字符串值的方法进行了ajax调用Jsf p:对话框无法填充值,jsf,primefaces,Jsf,Primefaces,已经对设置bean中字符串值的方法进行了ajax调用 var url = contextPath+'/SlCustomObjectCalls?stCallType=attachmentList&stMandDocumentName='+stMandDocumentName; $.ajax({ type: 'POST', url: url, dataType: 'json', success: function(data) { dlg1.s
var url = contextPath+'/SlCustomObjectCalls?stCallType=attachmentList&stMandDocumentName='+stMandDocumentName;
$.ajax({
type: 'POST',
url: url,
dataType: 'json',
success: function(data) {
dlg1.show();
}
});
这将设置字符串[]attachmentList中的值
public class AttachmentViewHelper {
String[] attachmentList;
public String[] getAttachmentList() {
return attachmentList;
}
public void setAttachmentList(String[] attachmentList) {
this.attachmentList = attachmentList;
}
public void getAttachments(){
try {
String stDocCode = "someval";
String stProcCode = "";
String stDocNumber ="";
String stComapny = "";
// gets String []
attachmentList = getListOfAttahments(stDocCode);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
一旦成功,ajax将打开对话框,我想在其中显示附件列表的值
<p:dialog id="downloadAttachemntDiag" header="Download" widgetVar="dlg1" width="300" height="200" resizable="false" draggable="false"
modal="true">
<div id="attachment">#{AttachmentViewHelper.attachmentList}</div>
#{AttachmentViewHelper.attachmentList}
现在我面临的问题是,对话框没有显示任何值。
我尝试过使用c:foreach和ui:repeat,但不起作用。
提前谢谢你。我不知道你打了ajax电话。 然而,我知道的一件事是,您的对话框最初发送时带有一个从未更新的空列表 因此,因为我不太了解jsf中的香草ajax,所以可以使用primefaces的标记或update属性
<p:commandButton ... update="downloadAttachemntDiag"/>
我不会使用ajax函数来发布文章。您可以使用普通的primefaces+jsf来实现这一点。primefaces提供了多种方法来选择对话框,为什么选择核心ajax?放弃了使用ajax的想法,它与remotecommand一起工作。