【问题标题】:primefaces dialog Model didn't show any valueprimefaces 对话框模型没有显示任何值
【发布时间】:2012-07-10 13:39:32
【问题描述】:

我正在使用 primefaces 对话框模型在单击按钮时显示更多详细信息。但我无法获取对话框上的值。

   <p:dataGrid id ="boardpanel" var="item" value="#{bLDashBoardAction.listBondLoc}" columns="#{message.no_of_columns}"  
    rows="20" paginator="true">  

    <p:column>  
        <p:panel header="Details" style="text-align:center">  
            <h:panelGrid columns="1" style="width:100%;">  


         <h:outputText value="#{item.rackTagCode}"  title="#{item.rackTagCode}" /> 

                <p:commandLink update=":frmDashBoard:blDetail" oncomplete="blDialog.show()" title="View Detail">  
                    <p:graphicImage value="/images/search.png"/>   
                    ***<f:setPropertyActionListener value="#{item}" 
                            target="#{bLDashBoardAction.rackTagCode}" />***  
                </p:commandLink>  
            </h:panelGrid>  
        </p:panel>  
    </p:column>  

</p:dataGrid>  

<p:dialog header="BL Detail" widgetVar="blDialog" modal="true">
  <p:outputPanel id="blDetail" style="text-align:center;" layout="block">
 <h:panelGrid  columns="2" cellpadding="2">
    <h:outputLabel for="blNo" value="BL " />
        ***<h:outputText id="blNo" value="#{item.rackTagCode}" />*** 

</h:panelGrid>

我从 BLDashBoardAction 类的 getListBondLoc 函数中获取 rackTagCode 列表。 这是我的 getListBondLoc 函数:

private String  bondLocationId;
private String  serviceAreaId;
private String facilityId;
private String bondLocationCode;
private String awb;
private String  zoneId;
private String  sectorId;
private String rackTagCode;
private String blTagCode;
private String ipAddress;
private String  ptlStatusId;
private String errorCode;
private String processIndicator;
private String textMsg;
private String rackTagCodeSel;
private BondLocationEBean beanSel;

private List<BondLocationEBean> listBondLoc;

public String navigateList(){
    listBondLoc = bondLocBusServ.searchBondLocList();
    return "/jsp/dashboard/dashboard";
}

public void doSearch()
{

    listBondLoc = bondLocBusServ.searchBondLocList(sectorId, zoneId, facilityId,ptlStatusId);
}

其余代码是上述属性的 getter 和 setter,其中 BondLocationEBean 映射到 db 中的所有列。

提前致谢。

【问题讨论】:

    标签: jsf dialog primefaces


    【解决方案1】:

    您在对话框中调用了错误类型的变量。改变

    &lt;h:outputText id="blNo" value="#{item.rackTagCode}" /&gt;

    <h:outputText id="blNo" value="#{bLDashBoardAction.rackTagCode}" /> 
    

    【讨论】:

    • 嗨,谢谢你的回答。但我在对话框中得到了这样的结果:persistence.bean.BondLocationEBean@1d60b6a,我需要转换什么吗?
    • 在您的&lt;f:setPropertyActionListener value="#{item}" target="#{bLDashBoardAction.rackTagCode}"/&gt; 中将值设置为#{item.rackTagCode},这可能会解决问题
    • 像上面那样改了之后,什么都没有打印出来
    • 你的班级叫什么名字?
    • 我获得列表的 ActionClass 的名称:BLDashBoardACtion,Ebean 类名称 - BondLocationEBean
    【解决方案2】:

    终于找到了解决办法,

    <f:setPropertyActionListener value="#{item}" 
                            target="#{bLDashBoardAction.blEbean}" />
    

    我应该将一个 Ebean 对象作为目标,然后我可以使用 bLDashBoardAction.blEbean.rackTagCode 获取变量。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-28
      • 1970-01-01
      • 1970-01-01
      • 2014-12-19
      • 1970-01-01
      • 1970-01-01
      • 2015-11-21
      • 1970-01-01
      相关资源
      最近更新 更多