📄 queryresult.jsp
字号:
<%-- tpl:insert page="/template/jsfTemplate.jtpl" --%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="../theme/Master.css" rel="stylesheet" type="text/css">
<LINK href="../theme/new.css" rel="stylesheet">
<LINK rel="stylesheet" type="text/css" href="../theme/stylesheet.css" title="Style">
<%-- tpl:put name="headarea" --%>
<SCRIPT type="text/javascript">
function func_1(thisObj, thisEvent) {
//use 'thisObj' to refer directly to this component instead of keyword 'this'
//use 'thisEvent' to refer to the event generated instead of keyword 'event'
document.forms['form1'].submit();
}
</SCRIPT>
<title>queryResult.jsp</title>
<%-- /tpl:put --%>
<LINK rel="stylesheet" type="text/css" href="/JSFandSDO/theme/stylesheet.css" title="Style">
</HEAD>
<f:view>
<BODY>
<TABLE class="title" cellpadding="0">
<TBODY>
<TR>
<TD class="noBorder" background="../images/gradient.jpg"
align="CENTER"><IMG border="0" src="../images/title.jpg"></TD>
</TR>
<TR>
<TD class="noBorder" align="RIGHT"><A href="/JSFandSDO">Return to Main Menu</A></TD>
</TR>
</TBODY>
</TABLE>
<%-- tpl:put name="bodyarea" --%>
<hx:scriptCollector id="scriptCollector1">
<h:form styleClass="form" id="form1">
<H2>Using an SDO Query to Filter Data</H2>
This sample contains an relational record list that is filtered using an SDO query on a database. The filtered results will be displayed next to the Full Catalog.<BR>
<BR>
<TABLE class="noBorder">
<TBODY>
<TR>
<TD class="noBorder">Filter Catalog:</TD>
<TD class="noBorder"><h:selectOneMenu styleClass="selectOneMenu" id="menu1" value="#{requestScope.searchBy}" valueChangeListener="#{pc_QueryResult.handleMenu1ValueChange}" onchange="return func_1(this, event);">
<f:selectItem itemValue="%" itemLabel="Filter By..." />
<f:selectItem itemValue="Television" itemLabel="Television" />
<f:selectItem itemValue="DVD Player" itemLabel="DVD Player" />
<f:selectItem itemValue="Digital Camera" itemLabel="Digital Camera" />
</h:selectOneMenu></TD>
</TR>
<TR>
<TD class="noBorder"></TD>
<TD class="noBorder"></TD>
</TR>
</TBODY>
</TABLE>
<TABLE cellpadding="3" width="100%" class="noBorder">
<TBODY>
<TR>
<TH width="50%" class="noBorder">Full Catalog</TH>
<TH width="50%" class="noBorder">Filtered Results</TH>
</TR>
<TR>
<TD align="center" valign="top" class="noBorder"><h:dataTable id="table2" value="#{pc_QueryResult.viewFullCatalog}" var="varviewFullCatalog" styleClass="dataTable" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1, rowClass2" columnClasses="columnClass1" border="1" cellpadding="2" cellspacing="0">
<h:column id="column6">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product ID" id="text13"></h:outputText>
</f:facet>
<h:outputText id="text14" value="#{varviewFullCatalog.PRODUCT_ID}" styleClass="outputText">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column id="column7">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product Type" id="text15"></h:outputText>
</f:facet>
<h:outputText id="text16" value="#{varviewFullCatalog.PRODUCT_TYPE}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column8">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product Name" id="text17"></h:outputText>
</f:facet>
<h:outputText id="text18" value="#{varviewFullCatalog.PRODUCT_NAME}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column9">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Description" id="text19"></h:outputText>
</f:facet>
<h:outputText id="text20" value="#{varviewFullCatalog.PRODUCT_DESCRIPTION}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column10">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Price" id="text21"></h:outputText>
</f:facet>
<h:outputText id="text22" value="#{varviewFullCatalog.PRODUCT_PRICE}" styleClass="outputText">
<f:convertNumber type="currency" />
</h:outputText>
<f:attribute value="right" name="align" />
</h:column>
</h:dataTable></TD>
<TD align="center" valign="top" class="noBorder"><h:dataTable id="table1" value="#{pc_QueryResult.productSearch}" var="varproductSearch" styleClass="dataTable" headerClass="headerClass" footerClass="footerClass" rowClasses="rowClass1, rowClass2" columnClasses="columnClass1" border="1" cellpadding="3" cellspacing="0" rendered="false">
<h:column id="column1">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product ID" id="text2"></h:outputText>
</f:facet>
<h:outputText id="text3" value="#{varproductSearch.PRODUCT_ID}" styleClass="outputText">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column id="column2">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product Type" id="text4"></h:outputText>
</f:facet>
<h:outputText id="text5" value="#{varproductSearch.PRODUCT_TYPE}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column3">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product Name" id="text6"></h:outputText>
</f:facet>
<h:outputText id="text7" value="#{varproductSearch.PRODUCT_NAME}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column4">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Description" id="text8"></h:outputText>
</f:facet>
<h:outputText id="text9" value="#{varproductSearch.PRODUCT_DESCRIPTION}" styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column5">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Price" id="text10"></h:outputText>
</f:facet>
<h:outputText id="text11" value="#{varproductSearch.PRODUCT_PRICE}" styleClass="outputText">
<f:convertNumber type="currency" />
</h:outputText>
<f:attribute value="right" name="align" />
</h:column>
</h:dataTable><h:commandLink styleClass="commandLink" id="link3" rendered="false" action="#{pc_QueryResult.doLink3Action}">
<h:outputText styleClass="outputText" id="text26" value="Close Search Results"></h:outputText>
</h:commandLink></TD>
</TR>
</TBODY>
</TABLE>
<H3>How It works:</H3>Relational record lists can filter the data returned by their queries. The filter criteria can be dynamically set and passed, based on information entered by a user, to the SDO that was used to create the filters. In this sample, the user-supplied filter term is used to return all relevant objects from a database. <BR>
<BR>To create a filter query for a SDO:<BR>1. Open the Page Data view.<BR>2. Right-click on the SDO and select "Configure".
<BR>3. At the last step click "Filter results" link to open the "Filters" window and enter a filter statement.<BR>
<BR>
In this example we filter the PRODUCT_TYPE column of the database by the value in the the "requestScope.searchBy" variable. This value is set by the "Filter Catalog" menu.<BR>
<BR>
The action to set up the query is performed in the Value Changed Event method of the Filter combo box. To view this method select the combo box button and go to its Quick Edit view.<H4>Files of interest:</H4>
<UL>
<LI><B>WebContent/queryResult/queryResult.jsp</B> - (This Page) Where the JSF tags to create this page are located.</LI>
<LI><B>src/pagecode.queryResult.QueryResult.java</B> - Where
the action to set up the query takes place.</LI>
<LI><B>productSearch SDO object</B> - Found in the Page Data view of the queryResult.jsp page. Right-click on it and select Configure to see how the database is filtered.</LI>
</UL>
</h:form>
</hx:scriptCollector>
<%-- /tpl:put --%>
<TABLE class="title" cellpadding="0">
<TBODY>
<TR>
<TD class="noBorder" align="RIGHT"><A href="/JSFandSDO">Return to Main Menu</A></TD>
</TR>
</TBODY>
</TABLE>
</BODY>
</f:view>
</HTML><%-- /tpl:insert --%>
<%-- jsf:pagecode language="java" location="/src/pagecode/queryResult/QueryResult.java" --%><%-- /jsf:pagecode --%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -