小编pie*_*iet的帖子

如何在JSF Datatable中生成动态列?

想拥有以下数据表结构:

+--------------------------------------------------------------+
|       dynamic      |       dynamic      |      dynamic       |
|--------------------------------------------------------------|
| col1 | col2 | col3 | col1 | col2 | col3 | col1 | col2 | col3 |     
|--------------------------------------------------------------|
| data | data | data | data | data | data | data | data | data |
Run Code Online (Sandbox Code Playgroud)

原因是,我不知道在我请求数据库之前必须显示多少列.col1,col2,col3中的列始终相同.

我尝试使用以下数据表:

<h:form id="form">    
        <h:panelGrid columns="3" style="margin:10px 0">
            <p:outputLabel for="template" value="Adid:" style="font-weight:bold"/>
            <p:inputText id="template" value="#{reportingView.adId}" size="50"/>
            <p:commandButton update="kpi_table" actionListener="#{reportingView.updateColumns}" value="Create Data" process="@parent" icon="ui-icon-refresh" oncomplete="PF('carsTable').clearFilters()"/>
        </h:panelGrid>

        <p:dataTable id="reportingTable" var="pi" value="#{reportingView.indicators}" widgetVar="indicatorTable" filteredValue="#{reportingView.filteredValues}"> …
Run Code Online (Sandbox Code Playgroud)

jsf dynamic-columns

7
推荐指数
1
解决办法
7420
查看次数

如何使用LocalDate从spring查询elasticsearch

有这个搜索查询:

final SearchQuery searchQuery = new NativeSearchQueryBuilder().withQuery(QueryBuilders.rangeQuery("updateTime").gte(LocalDate.now())).build();
final List<ActivityValue> listOf = elasticsearchTemplate.queryForList(searchQuery, ActivityValue.class);
Run Code Online (Sandbox Code Playgroud)

对于实体 ActivityValue:

@Document(indexName = "tracking1", type = "activity")
public class ActivityValue {

@Id
private String id;

@Field(type = FieldType.Date, index = false, store = true, format = DateFormat.custom, pattern = "yyyy-MM-dd")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd")
private LocalDate updateTime;

@Field(type = FieldType.Object, includeInParent = true)
private Vendor vendor;

@Field(type = FieldType.Object, includeInParent = true)
private QCriteria quality;

public ActivityValue() {
}

//setter and getter
}
Run Code Online (Sandbox Code Playgroud)

如果我运行查询并尝试接收列表,我会收到以下异常: …

spring elasticsearch

5
推荐指数
1
解决办法
1984
查看次数

标签 统计

dynamic-columns ×1

elasticsearch ×1

jsf ×1

spring ×1