Jsf 编辑模式下的模态对话框中缺少值
我是Java和PrimeFaces方面的新手(我只使用过c#和visual sudio) 当我试图编辑行时,列值不会显示在模式对话框中。 我尝试了不同的解决方案,结果相同。 有人能帮我吗Jsf 编辑模式下的模态对话框中缺少值,jsf,primefaces,datatable,modal-dialog,Jsf,Primefaces,Datatable,Modal Dialog,我是Java和PrimeFaces方面的新手(我只使用过c#和visual sudio) 当我试图编辑行时,列值不会显示在模式对话框中。 我尝试了不同的解决方案,结果相同。 有人能帮我吗 <ui:include src="/includes/header.xhtml" /> <!-- Container --> <div id="container"> <div class="shell"> <div id="ma
<ui:include src="/includes/header.xhtml" />
<!-- Container -->
<div id="container">
<div class="shell">
<div id="main" style="vertical-align: middle;">
<br /> <br />
<form>
<p:dataTable var="loc" value="#{location.loc}" rowKey="#{loc.code}" id='loca'>
<p:column width="100">
<p:commandButton icon="ui-icon-plus" type="button" id="add" onclick="PF('newDialog').show()" update="Newform:NewLocation"/>
<p:commandButton icon="ui-icon-pencil" type="button" update="updForm:updDisplay" onclick="PF('updDialog').show()" id="edit" ajax="true">
</p:commandButton>
<p:commandButton icon="ui-icon-trash" />
</p:column>
<p:column headerText="Code">
<h:outputText value="#{loc.code}" />
</p:column>
<p:column headerText="Ip">
<h:outputText value="#{loc.address}" />
</p:column>
<p:column headerText="Descrizione">
<h:outputText value="#{loc.description}" />
</p:column>
</p:dataTable>
</form>
<p:dialog widgetVar="newDialog" header="Insert Location" width="430" height="220" modal="true">
<h:form id="Newform">
<p:outputPanel id="NewLocation">
<h:panelGrid columns="2">
<h:outputLabel value="Code" />
<p:inputText value="#{loc.Code}"></p:inputText>
<h:outputLabel value="description" />
<p:inputText value="#{loc.description}"></p:inputText>
<h:outputLabel value="Address" />
<p:inputText value="#{loc.address}"></p:inputText>
</h:panelGrid>
<p:commandButton value="Save" onclick="newDialog.close()">
</p:commandButton>
</p:outputPanel>
</p:dialog>
<p:dialog widgetVar="updDialog" header="Location" width="430" height="220" modal="true">
<h:form id="updForm">
<p:outputPanel id="updDisplay">
<h:inputHidden value="#{loc.code}" />
<h:panelGrid columns="2">
<h:outputLabel value="Description" />
<p:inputText value="#{loc.description}"></p:inputText>
<h:outputLabel value="Address" />
<p:inputText value="#{loc.address}"></p:inputText>
</h:panelGrid>
<p:commandButton value="Update" onclick="updDialog.close()">
</p:commandButton>
<p:commandButton value="Delete" onclick="updDialog.close()">
</p:commandButton>
<p:growl id="growl" showDetail="true" />
</p:outputPanel>
</h:form>
</p:dialog>
MangedBean:
@ManagedBean (name="Locations")
@SessionScoped
public class Locations {
@EJB
cslocationBeanRemote locationsBean;
private List<cslocationModel> ListLocations;
@SuppressWarnings({"unchecked", "rawtypes"})
@PostConstruct
public void init() {}
public List<cslocationModel> getListLocations() {
try {
ArrayList orderBy = new ArrayList();
orderBy.add(cslocationModel.ORDERcodASC);
setListLocations((List<cslocationModel>) locationsBean.find(null,
null, null, orderBy));
} catch (Exception ecc) {
ecc.printStackTrace();
}
return ListLocations;
}
public void setListLocations(List<cslocationModel> ListLocations) {
this.ListLocations = ListLocations;
}
}
@ManagedBean(name=“Locations”)
@会议范围
公共课地点{
@EJB
C位置Bean远程位置Bean;
私人名单地点;
@SuppressWarnings({“unchecked”,“rawtypes”})
@施工后
public void init(){}
公共列表getListLocations(){
试一试{
ArrayList orderBy=新的ArrayList();
add(cslocationModel.ORDERcodASC);
setListLocations((列表)locationsBean.find(空,
null,null,orderBy));
}捕获(异常ecc){
ecc.printStackTrace();
}
返回列表位置;
}
公共无效集合列表位置(列表列表位置){
this.ListLocations=ListLocations;
}
}
谢谢。由于其他原因,我现在还没有看到,请将
替换为
。我已替换为,但没有任何更改。你有别的解决办法吗?请帮帮我。谢谢。Locations
managedbean有什么用?它在XHTML中甚至没有使用过一次。请修正问题,使其更加连贯,并给出一个可重复性最低的示例。另外,您使用的PrimeFaces版本是什么?