1
您好,我正在開發一個使用Oracle ADF和jdeveloper11.1.2.4的Web應用程序。其實我有一個頁面的查詢和表單。搜索和一切都很好,但第一次加載頁面時是空的。它看起來不太好。所以我的想法是這種形式應該是最初不可見的,並且只有在用戶點擊搜索從(af:query)中的搜索按鈕後才應該可見。在adf Query中單擊搜索按鈕後如何使表單可見?
請幫助我。我如何才能做到這一點。
在此先感謝。
以下是我.jsf代碼
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<af:document title="Search/Modfiy KPI" id="d1">
<af:messages id="m1"/>
<af:form id="f1">
<af:pageTemplate viewId="/adminPageTemplate.jsf" id="pt1">
<f:facet name="Center">
<af:panelStretchLayout id="psl1">
<f:facet name="bottom"/>
<f:facet name="center">
<af:panelSplitter id="ps1" orientation="vertical" dimensionsFrom="children"
splitterPosition="191">
<f:facet name="first">
<af:panelGroupLayout layout="vertical" id="pgl1">
<af:query id="qryId1" headerText="Search KPI" disclosed="true"
value="#{bindings.KpiSearchCriteriaQuery.queryDescriptor}"
model="#{bindings.KpiSearchCriteriaQuery.queryModel}"
queryOperationListener="#{bindings.KpiSearchCriteriaQuery.processQueryOperation}"
fieldWidth="110"
queryListener="#{pageFlowScope.updateORDeleteBean.customSearch}"
partialTriggers="::pfl1"/>
</af:panelGroupLayout>
</f:facet>
<f:facet name="second">
<af:panelGroupLayout id="pgl5" layout="vertical" halign="center">
<af:panelGroupLayout id="pgl3" layout="horizontal" halign="center">
<af:panelGroupLayout layout="horizontal" id="pgl2">
<f:facet name="separator">
<af:spacer width="10" height="1" id="s1"/>
</f:facet>
<af:commandButton actionListener="#{bindings.First.execute}"
text="First" disabled="#{!bindings.First.enabled}"
partialSubmit="true" id="cb1"/>
<af:commandButton actionListener="#{bindings.Previous.execute}"
text="Previous"
disabled="#{!bindings.Previous.enabled}"
partialSubmit="true" id="cb2"/>
<af:commandButton actionListener="#{bindings.Next.execute}" text="Next"
disabled="#{!bindings.Next.enabled}"
partialSubmit="true" id="cb3"/>
<af:commandButton actionListener="#{bindings.Last.execute}" text="Last"
disabled="#{!bindings.Last.enabled}"
partialSubmit="true" id="cb4"/>
</af:panelGroupLayout>
<af:spacer width="10" height="10" id="s3"/>
<af:panelGroupLayout id="pgl4" layout="horizontal">
<af:commandButton text="Delete" id="cb5"
actionListener="#{updateORDeleteBean.delete}"/>
<af:spacer width="10" height="10" id="s2"/>
<af:commandButton text="Update" id="cb6"
actionListener="#{updateORDeleteBean.update}"/>
</af:panelGroupLayout>
</af:panelGroupLayout>
<af:panelFormLayout id="pfl1" visible="#{pageFlowScope.showForm}">
<af:inputText value="#{bindings.Id.inputValue}"
label="#{bindings.Id.hints.label}"
required="#{bindings.Id.hints.mandatory}"
columns="#{bindings.Id.hints.displayWidth}"
maximumLength="#{bindings.Id.hints.precision}"
shortDesc="#{bindings.Id.hints.tooltip}" id="it1"
readOnly="true">
<f:validator binding="#{bindings.Id.validator}"/>
<af:convertNumber groupingUsed="false" pattern="#{bindings.Id.format}"/>
</af:inputText>
<af:inputText value="#{bindings.KpiName.inputValue}"
label="#{bindings.KpiName.hints.label}"
required="#{bindings.KpiName.hints.mandatory}" columns="110"
maximumLength="#{bindings.KpiName.hints.precision}"
shortDesc="#{bindings.KpiName.hints.tooltip}" id="it2">
<f:validator binding="#{bindings.KpiName.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.KpiSql.inputValue}"
label="#{bindings.KpiSql.hints.label}"
required="#{bindings.KpiSql.hints.mandatory}" columns="110"
maximumLength="#{bindings.KpiSql.hints.precision}"
shortDesc="#{bindings.KpiSql.hints.tooltip}" id="it3"
rows="3">
<f:validator binding="#{bindings.KpiSql.validator}"/>
</af:inputText>
<af:selectOneChoice value="#{bindings.Category.inputValue}"
label="#{bindings.Category.label}"
required="#{bindings.Category.hints.mandatory}"
shortDesc="#{bindings.Category.hints.tooltip}"
id="soc1">
<f:selectItems value="#{bindings.Category.items}" id="si1"/>
</af:selectOneChoice>
<af:selectOneChoice value="#{bindings.Module.inputValue}"
label="#{bindings.Module.label}"
required="#{bindings.Module.hints.mandatory}"
shortDesc="#{bindings.Module.hints.tooltip}" id="soc2">
<f:selectItems value="#{bindings.Module.items}" id="si2"/>
</af:selectOneChoice>
<af:selectOneChoice value="#{bindings.Submodule.inputValue}"
label="#{bindings.Submodule.label}"
required="#{bindings.Submodule.hints.mandatory}"
shortDesc="#{bindings.Submodule.hints.tooltip}"
id="soc3">
<f:selectItems value="#{bindings.Submodule.items}" id="si3"/>
</af:selectOneChoice>
<af:inputText value="#{bindings.Threshold.inputValue}"
label="#{bindings.Threshold.hints.label}"
required="#{bindings.Threshold.hints.mandatory}" columns="15"
maximumLength="#{bindings.Threshold.hints.precision}"
shortDesc="#{bindings.Threshold.hints.tooltip}" id="it4">
<f:validator binding="#{bindings.Threshold.validator}"/>
<af:convertNumber groupingUsed="false"
pattern="#{bindings.Threshold.format}"/>
</af:inputText>
<af:selectOneChoice value="#{bindings.Operator1.inputValue}"
label="#{bindings.Operator1.label}"
required="#{bindings.Operator1.hints.mandatory}"
shortDesc="#{bindings.Operator1.hints.tooltip}"
id="soc4">
<f:selectItems value="#{bindings.Operator1.items}" id="si4"/>
</af:selectOneChoice>
<af:inputText value="#{bindings.Helptext.inputValue}"
label="#{bindings.Helptext.hints.label}"
required="#{bindings.Helptext.hints.mandatory}" columns="110"
maximumLength="#{bindings.Helptext.hints.precision}"
shortDesc="#{bindings.Helptext.hints.tooltip}" id="it5">
<f:validator binding="#{bindings.Helptext.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.PerfReason.inputValue}"
label="#{bindings.PerfReason.hints.label}"
required="#{bindings.PerfReason.hints.mandatory}"
columns="110"
maximumLength="#{bindings.PerfReason.hints.precision}"
shortDesc="#{bindings.PerfReason.hints.tooltip}" id="it6">
<f:validator binding="#{bindings.PerfReason.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.XaxisDescription.inputValue}"
label="#{bindings.XaxisDescription.hints.label}"
required="#{bindings.XaxisDescription.hints.mandatory}"
columns="110"
maximumLength="#{bindings.XaxisDescription.hints.precision}"
shortDesc="#{bindings.XaxisDescription.hints.tooltip}"
id="it7">
<f:validator binding="#{bindings.XaxisDescription.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.YaxisDesciption.inputValue}"
label="#{bindings.YaxisDesciption.hints.label}"
required="#{bindings.YaxisDesciption.hints.mandatory}"
columns="110"
maximumLength="#{bindings.YaxisDesciption.hints.precision}"
shortDesc="#{bindings.YaxisDesciption.hints.tooltip}"
id="it8">
<f:validator binding="#{bindings.YaxisDesciption.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.Dschemaname.inputValue}"
label="#{bindings.Dschemaname.hints.label}"
required="#{bindings.Dschemaname.hints.mandatory}"
columns="50"
maximumLength="#{bindings.Dschemaname.hints.precision}"
shortDesc="#{bindings.Dschemaname.hints.tooltip}" id="it9">
<f:validator binding="#{bindings.Dschemaname.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.Dtablename.inputValue}"
label="#{bindings.Dtablename.hints.label}"
required="#{bindings.Dtablename.hints.mandatory}"
maximumLength="#{bindings.Dtablename.hints.precision}"
shortDesc="#{bindings.Dtablename.hints.tooltip}" id="it10"
columns="50">
<f:validator binding="#{bindings.Dtablename.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.Dfieldname.inputValue}"
label="#{bindings.Dfieldname.hints.label}"
required="#{bindings.Dfieldname.hints.mandatory}" columns="50"
maximumLength="#{bindings.Dfieldname.hints.precision}"
shortDesc="#{bindings.Dfieldname.hints.tooltip}" id="it11">
<f:validator binding="#{bindings.Dfieldname.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.Toemail.inputValue}"
label="#{bindings.Toemail.hints.label}"
required="#{bindings.Toemail.hints.mandatory}" columns="50"
maximumLength="#{bindings.Toemail.hints.precision}"
shortDesc="#{bindings.Toemail.hints.tooltip}" id="it12">
<f:validator binding="#{bindings.Toemail.validator}"/>
</af:inputText>
<af:inputText value="#{bindings.CcEmail.inputValue}"
label="#{bindings.CcEmail.hints.label}"
required="#{bindings.CcEmail.hints.mandatory}" columns="50"
maximumLength="#{bindings.CcEmail.hints.precision}"
shortDesc="#{bindings.CcEmail.hints.tooltip}" id="it13">
<f:validator binding="#{bindings.CcEmail.validator}"/>
</af:inputText>
<af:selectOneChoice value="#{bindings.AutomoniterEnabled.inputValue}"
label="#{bindings.AutomoniterEnabled.label}"
required="#{bindings.AutomoniterEnabled.hints.mandatory}"
shortDesc="#{bindings.AutomoniterEnabled.hints.tooltip}"
id="soc5">
<f:selectItems value="#{bindings.AutomoniterEnabled.items}" id="si5"/>
</af:selectOneChoice>
<af:inputText value="#{bindings.AuditInfo.inputValue}"
label="#{bindings.AuditInfo.hints.label}"
required="#{bindings.AuditInfo.hints.mandatory}"
columns="#{bindings.AuditInfo.hints.displayWidth}"
maximumLength="#{bindings.AuditInfo.hints.precision}"
shortDesc="#{bindings.AuditInfo.hints.tooltip}" id="it14"
readOnly="true">
<f:validator binding="#{bindings.AuditInfo.validator}"/>
</af:inputText>
<f:facet name="footer"/>
</af:panelFormLayout>
</af:panelGroupLayout>
</f:facet>
</af:panelSplitter>
</f:facet>
<f:facet name="start"/>
<f:facet name="end"/>
<f:facet name="top"/>
</af:panelStretchLayout>
</f:facet>
</af:pageTemplate>
</af:form>
</af:document>
</f:view>
的follwoing SI我的Java類代碼
public void customSearch(QueryEvent queryEvent) {
// Add event code here...
System.out.println("in custom srch");
AdfFacesContext.getCurrentInstance().getPageFlowScope().put("showForm", true);
invokeEL("#{bindings.KpiSearchCriteriaQuery.processQuery}", new Class[] { QueryEvent.class },
new Object[] { queryEvent });
System.out.println("end custom srch");
}
感謝您的時間馬庫斯。我嘗試了你的答案。我遵循每一步。 customSearch(QueryEvent queryEvent)方法正常工作。手段SerchCriteria正在工作。但是這種可見性解決方案並不適用。 – Abdul
我已經設置窗體可見=#{pageFlowScope.updateORDeleteBean.showForm}。我有複製粘貼上面的代碼。但能見度並未開啓或關閉。 – Abdul
你需要在panelFormLayout上設置一個局部觸發器,指向af:詢問 –