JSF下dataGrid与Action绑定问题

今天在做页面与action的datatree绑定时,碰到一个莫名奇妙的问题:

       页面如下:

       <layout:panel region="center" animFloat="false" autoHide="false" border="false"
      fit="true" title="查询结果">
      <w:dataGrid id="grid" showRowNumber="false" paged="true" rows="10" loadMask="true"
      forceFit="true" toolBarPosition="both" border="false" rowInitHeight="22" trackMouseOver="true"
      stripeRows="true" jsvar="gridJs">
       <w:toolBar styleClass="headerToolBar">
        <w:button οnclick="deleteNode();" image="#{hdf:reqContextPath()}/images/icons/delete.png" jsvar="deleteNodeJsvar" label="告警关闭" disabled="true"/>
        <w:separator />      
       </w:toolBar>
       <w:outputColumn id="eventName" header="事件名称" sortable="true" ></w:outputColumn>
       <w:outputColumn id="soureType" header="资源类型" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcLevel" header="告警等级" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcType" header="告警类型"  sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcContent" header="告警内容" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcCount" header="次数" sortable="true"></w:outputColumn> 
       <w:outputColumn id="nodeid" header="选择"  clientFormatter="showRadio" width="24" align="center" />
       <w:outputColumn id="eventName" header="事件名称" sortable="true" clientFormatter="titleFormat"/>
       <w:outputColumn id="resourceType" header="资源类型" sortable="true"/>
       <w:outputColumn id="resourceName"  header="资源名称"></w:outputColumn>
       <w:outputColumn id="clctName"  header="采集器名称"></w:outputColumn>
       <w:outputColumn id="eventLevel" header="告警等级" sortable="true"></w:outputColumn>
       <w:outputColumn id="emgcTitle" header="告警标题" sortable="true"></w:outputColumn>      
       <w:outputColumn id="emgcContext" header="告警内容" sortable="true"></w:outputColumn>      
       <w:outputColumn id="notify" header="通知人" sortable="true" clientFormatter="nodehostFormat"></w:outputColumn>
       <w:outputColumn id="firstTime"  header="第一次告警时间" sortable="true"></w:outputColumn>
       <w:outputColumn id="lastTime" header="最后一次告警时间" sortable="true"></w:outputColumn>
       <w:outputColumn id="count" header="次数" sortable="true"></w:outputColumn>
       <w:outputColumn id="history" header="告警明细" sortable="true"></w:outputColumn>
       <w:outputColumn id="state" header="状态" sortable="true"></w:outputColumn>      
       <w:pagingToolbar displayInfo="true" displayMsg="显示 {0} - {1},共 {2} 条" />
      </w:dataGrid>
     </layout:panel>

 

     托管Bean获取数据方法如下:

   @Bind
 private UIDataGrid grid;

    @DataModel(id = "grid")
 public List<EmgcCommonBean> getPresentEmgc() throws Exception{
  Map<String, Object> param = new HashMap<String, Object>();
 
  if(null != this.emgcType && !"".equals(this.emgcType)){
   param.put("emgcType", emgcType);
  }
 
 
 
  List<EmgcCommonBean> list = EmgcApprove.getInstance().queryPersentEmgc(param);
  System.out.println(list.get(0).getEventName().toString);
 
  return list;
 }

  后台获取数据正常,System能打印了,但前端却怎么都不显示。

 

  经过仔细一番调试,发现后台的字段与页面字段不一致导致。(我为了好调试,后台只先读取了几个字段,而页面显示的是所有字段),我把页面多余的字段都去掉,保持与后台读出的字段一致,嘿,正常了。

 我们用的框架是金蝶的OperaMasks,看来对datatree的封装还有bug啊!(或者说还不太好用!)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
对于Spring Boot整合JSF,你可以按照以下步骤进行操作: 1. 添加JSF依赖:在pom.xml文件中,添加JSF的依赖项,如下所示: ```xml <dependency> <groupId>javax.faces</groupId> <artifactId>javax.faces-api</artifactId> <version>2.3</version> </dependency> ``` 2. 配置JSF Servlet:在Spring Boot的配置类中,添加以下配置,以将JSF Servlet映射到`/javax.faces`路径下: ```java import javax.faces.webapp.FacesServlet; import org.springframework.boot.web.servlet.ServletRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration public class JsfConfig { @Bean public ServletRegistrationBean<FacesServlet> facesServletRegistration() { ServletRegistrationBean<FacesServlet> registration = new ServletRegistrationBean<>(new FacesServlet(), "*.jsf"); registration.setName("FacesServlet"); return registration; } } ``` 3. 配置JSF View Resolver:在Spring Boot的配置类中,添加以下配置,以将JSF视图解析为`.xhtml`文件: ```java import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.ViewResolver; import org.springframework.web.servlet.view.InternalResourceViewResolver; @Configuration public class JsfConfig { @Bean public ViewResolver internalResourceViewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setViewClass(JsfView.class); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".xhtml"); return resolver; } } ``` 4. 创建JSF视图:在`/WEB-INF/views/`目录下创建JSF视图文件,例如`hello.xhtml`,并在其中定义JSF组件。 现在,你已经成功地将Spring Boot与JSF整合起来了。你可以在JSF视图中使用JSF的标签和组件。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值