刷新JSF片段中的表
我知道这很简单,但我似乎无法让它工作我知道如何使用部分触发,但不知为什么,我似乎无法使它工作。我的问题是,在我的jsf片段中有一个刷新JSF片段中的表,jsf,oracle-adf,Jsf,Oracle Adf,我知道这很简单,但我似乎无法让它工作我知道如何使用部分触发,但不知为什么,我似乎无法使它工作。我的问题是,在我的jsf片段中有一个(我使用任务流创建这个片段)我想做的是在我的文本字段上使用valuechangelistener创建一个简单的搜索方法,这样表就会搜索文本字段上发生的每一个更改问题是,似乎不起作用,它会保留表中的旧值,它不会刷新,或者你对此有什么解决办法吗这是一种问题。为了清楚起见,我将发布一些代码 JSF片段页面: <?xml version='1.0' encoding='
(我使用任务流创建这个片段)我想做的是在我的文本字段上使用valuechangelistener创建一个简单的搜索方法,这样表就会搜索文本字段上发生的每一个更改问题是,
似乎不起作用,它会保留表中的旧值,它不会刷新,或者你对此有什么解决办法吗这是一种问题。为了清楚起见,我将发布一些代码
JSF片段页面:
<?xml version='1.0' encoding='UTF-8'?>
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:f="http://java.sun.com/jsf/core">
<af:panelStretchLayout id="psl1" inlineStyle="width: 900px;">
<f:facet name="center">
<af:panelGroupLayout layout="scroll" id="pgl3">
<af:panelGridLayout id="pgl1">
<af:gridRow marginTop="5px" marginBottom="5px" height="auto" id="gr1">
<af:gridCell marginStart="10px" width="100px" id="gc1" halign="end" valign="middle">
<af:outputLabel value="Search: " id="ol1" inlineStyle="color:Black; font-size:12px; font-weight:bold;"/>
</af:gridCell>
<af:gridCell marginStart="10px" width="250px" id="gc2" halign="start" valign="middle">
<af:inputText label=" " valueChangeListener="#{personnelFragment.SearchRecords}" autoSubmit="true" columns="40" id="searchTxt"/>
</af:gridCell>
<af:gridCell marginStart="10px" width="100px" id="gc3" halign="end" valign="middle">
<af:outputLabel value="Sort By: " id="ol2" inlineStyle="color:Black; font-size:12px; font-weight:bold;"/>
</af:gridCell>
<af:gridCell marginStart="10px" marginEnd="5px" width="25%" id="gc4">
<af:selectOneChoice label=" " id="soc1">
<af:selectItem label="Firstname" id="si1"/>
<af:selectItem label="Middlename" id="si2"/>
<af:selectItem label="Lastname" id="si3"/>
</af:selectOneChoice>
</af:gridCell>
</af:gridRow>
</af:panelGridLayout>
<af:table width="700px" partialTriggers=":searchTxt" id="t1" value="#{personnelFragment.personnelInfoData}" var="PersonnelData"
horizontalGridVisible="true" verticalGridVisible="true" inlineStyle="margin: 10px 0 10px 0;"
rowSelection="single">
<af:column headerText="Prefix" align="center" id="c4">
<af:outputLabel value="#{PersonnelData.prefix}" id="ol6"
inlineStyle="color:Black; font-size:10px;"/>
</af:column>
<af:column headerText="Firstname" align="center" id="c1">
<af:outputLabel value="#{PersonnelData.firstName}" id="ol3"
inlineStyle="color:Black; font-size:10px;"/>
</af:column>
<af:column headerText="Middlename" align="center" id="c2">
<af:outputLabel value="#{PersonnelData.middleName}" id="ol4"
inlineStyle="color:Black; font-size:10px;"/>
</af:column>
<af:column headerText="Lastname" align="center" id="c3">
<af:outputLabel value="#{PersonnelData.lastName}" id="ol5"
inlineStyle="color:Black; font-size:10px;"/>
</af:column>
<af:column headerText="Suffix" align="center" id="c5">
<af:outputLabel value="#{PersonnelData.suffix}" id="ol7"
inlineStyle="color:Black; font-size:10px;"/>
</af:column>
<af:column headerText=" " align="center" id="c6">
<af:commandImageLink id="cil1" icon="#{resource['images:check.png']}" actionListener="#{personnelFragment.SearchPersonnelInfo}" />
</af:column>
</af:table>
</af:panelGroupLayout>
</f:facet>
<f:facet name="top"/>
我使用了存储过程,这段代码运行良好,正如您所见,我将示例结果打印到日志中,运行良好。我的问题是刷新页面
1) 。partialTrigger是否只有在有
标记时才会发生?(因为jsf片段不支持
)
2) 我刚才搜索过,在一些论坛中,他们以编程方式创建触发器,如下所示AdfFacesContext.getCurrentInstance().addPartialTarget(组件)你能给我解释一下这个代码的用途吗?
3) 如何刷新jsf片段中的表
非常感谢您的帮助和指导。尝试手动刷新支持bean中的表,如:
AdfFacesContext.getCurrentInstance().addPartialTarget(t1) 1)af:form标记位于jsp/jspx页面中,您可以在该页面中删除片段/任务流(您可以检查它)。
2) 与partialTrigger属性相同,但使用bean中定义的绑定代替ID。
3) 正如您所说,使用partialTrigger=“组件的id”
由于您使用的是bean来显示数据,您可能需要检查iteraor上的缓存(检查绑定,选择您的迭代器,检查属性)。您没有使用。你正在使用。我修复了不正确的标签。谢谢baluc,很抱歉回复太晚:)我已经尝试过这个代码,但它不起作用。或者我的代码有错误,我在论坛上看到了这段代码,但我不明白该把它放在哪里?我应该将此代码放在valuechangelistener代码上吗?
calState = (OracleCallableStatement)con.prepareCall("{ call SEARCH_PERSONNELINFO(?, ?) }");
calState.setObject(1, e.getNewValue());
calState.registerOutParameter(2, OracleTypes.CURSOR);
calState.execute();
rs = (ResultSet)calState.getObject(2);
while(rs.next()){
PersonnelInfoData.add(new GetPersonnelData(rs.getInt(1), rs.getString(2), rs.getString(3),
rs.getString(4), rs.getString(5), rs.getString(6)));
System.out.println(rs.getInt(1) +" "+ rs.getString(2));
}
calState.close();