📄 rowactionselect.jsp
字号:
<h:column id="column13">
<f:facet name="header">
<h:outputText styleClass="outputText" value="City" id="text23"></h:outputText>
</f:facet>
<h:outputText id="text24" value="#{varcustomers.CITY}"
styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column14">
<f:facet name="header">
<h:outputText styleClass="outputText" value="State" id="text25"></h:outputText>
</f:facet>
<h:outputText id="text26" value="#{varcustomers.STATE}"
styleClass="outputText">
</h:outputText>
</h:column>
</h:dataTable></P>
<hx:commandExButton type="submit" value="Delete Selected Records"
styleClass="commandExButton" id="buttonDelete3"
action="#{pc_RowActionSelect.doButtonDelete3Action}"></hx:commandExButton>
<BR>
<BR>
<table>
<tbody>
<tr>
<td align="left">Id:</td>
<td style="width:5px"> </td>
<td align="left">Name:</td>
<td style="width:5px"> </td>
<td align="left">Address:</td>
<td style="width:5px"> </td>
<td align="left">City:</td>
<td style="width:5px"> </td>
<td align="left">State:</td>
<td style="width:5px"> </td>
</tr>
<tr>
<td><h:inputText id="textId1"
value="#{pc_RowActionSelect.addCustomer_3.ID}"
styleClass="inputText">
<hx:convertNumber />
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textName1"
value="#{pc_RowActionSelect.addCustomer_3.NAME}"
styleClass="inputText">
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textAddress1"
value="#{pc_RowActionSelect.addCustomer_3.ADDRESS}"
styleClass="inputText">
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textCity1"
value="#{pc_RowActionSelect.addCustomer_3.CITY}"
styleClass="inputText">
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textState1"
value="#{pc_RowActionSelect.addCustomer_3.STATE}"
styleClass="inputText">
</h:inputText></td>
<td style="width:5px"> </td>
</tr>
</tbody>
</table>
<h:messages styleClass="messages" id="messages1" style="color: red"></h:messages>
<br />
<hx:commandExButton id="buttonDoAddCustomer_3UpdateAction1"
styleClass="commandExButton" type="submit" value="Add a Record"
action="#{pc_RowActionSelect.doAddCustomer_3UpdateAction}">
</hx:commandExButton>
<br>
<BR>
<HR>
<H4>Exercise 4 - Orders</H4>This data table uses a Collection (ArrayList) of Map (HashMap) objects to bind the check boxes to the backing bean. The map stores the name and value of a parameter for each row. A parameter must be assigned to the row select column by going to the Parameter tab in the row select Properties view and selecting "Add Parameter". In this example the parameter named is ID and is assigned to the Order ID field. There is also an Update Order Status button that changes the status of an order from "Open" to "Closed" if it is selected<BLOCKQUOTE>
<P class="code">Example:<BR>
<h:column id="column21"><BR>
<hx:inputRowSelect styleClass="inputRowSelect"
id="rowSelect3"
value="#{pc_RowActionSelect.selectedRow.listRows}"><BR>
<f:param name="ID"
value="#{varorders.ID}"></f:param><BR>
</hx:inputRowSelect><BR>
<f:facet name="header"></f:facet><BR>
</h:column></P>
</BLOCKQUOTE>
<P><h:dataTable id="table3"
value="#{pc_RowActionSelect.orders}" var="varorders"
styleClass="dataTable" headerClass="headerClass"
footerClass="footerClass" rowClasses="rowClass1, rowClass2"
columnClasses="columnClass1" border="1" cellpadding="3"
cellspacing="0">
<h:column id="column21">
<%--Row Select column and its parameter --%>
<hx:inputRowSelect styleClass="inputRowSelect" id="rowSelect3"
value="#{pc_RowActionSelect.selectedRow.listRows}">
<f:param name="ID" value="#{varorders.ID}"></f:param>
</hx:inputRowSelect>
<f:facet name="header"></f:facet>
</h:column>
<h:column id="column16">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Order ID"
id="text27"></h:outputText>
</f:facet>
<h:outputText id="text28" value="#{varorders.ID}"
styleClass="outputText">
</h:outputText>
</h:column>
<h:column id="column17">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Customer ID"
id="text29"></h:outputText>
</f:facet>
<h:outputText id="text30" value="#{varorders.CUSTOMERID}"
styleClass="outputText">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column id="column18">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Product ID"
id="text31"></h:outputText>
</f:facet>
<h:outputText id="text32" value="#{varorders.PRODUCTID}"
styleClass="outputText">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column id="column19">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Date of Order"
id="text33"></h:outputText>
</f:facet>
<h:outputText id="text34" value="#{varorders.DATEPLACED}"
styleClass="outputText">
<f:convertDateTime />
</h:outputText>
</h:column>
<h:column id="column20">
<f:facet name="header">
<h:outputText styleClass="outputText" value="Status" id="text35"></h:outputText>
</f:facet>
<h:outputText id="text36" value="#{varorders.STATUS}"
styleClass="outputText">
</h:outputText>
</h:column>
</h:dataTable></P>
<hx:commandExButton type="submit" value="Delete Selected Records"
styleClass="commandExButton" id="buttonDelete4"
action="#{pc_RowActionSelect.doButtonDelete4Action}"></hx:commandExButton>
<hx:commandExButton type="submit" value="Update Order Status"
styleClass="commandExButton" id="buttonUpdate4"
action="#{pc_RowActionSelect.doButtonUpdate4Action}"></hx:commandExButton>
<BR>
<BR>
<table>
<tbody>
<tr>
<td align="left">Id:</td>
<td style="width:5px"> </td>
<td align="left">Customerid:</td>
<td style="width:5px"> </td>
<td align="left">Productid:</td>
<td style="width:5px"> </td>
<td align="left">Dateplaced:</td>
<td style="width:5px"> </td>
<td align="left" width="63">Status:</td>
<td style="width:5px" width="2"> </td>
</tr>
<tr>
<td><h:inputText id="textCustomerid1"
value="#{pc_RowActionSelect.addOrder_4.ID}"
styleClass="inputText">
<hx:convertNumber />
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textId3"
value="#{pc_RowActionSelect.addOrder_4.CUSTOMERID}"
styleClass="inputText">
<hx:convertNumber />
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textProductid1"
value="#{pc_RowActionSelect.addOrder_4.PRODUCTID}"
styleClass="inputText">
<hx:convertNumber />
</h:inputText></td>
<td style="width:5px"> </td>
<td><h:inputText id="textDateplaced1"
value="#{pc_RowActionSelect.addOrder_4.DATEPLACED}"
styleClass="inputText">
<hx:inputHelperDatePicker />
<hx:convertDateTime />
</h:inputText></td>
<td style="width:5px"> </td>
<td width="63"><h:selectOneMenu id="menuStatus1"
value="#{pc_RowActionSelect.addOrder_4.STATUS}"
styleClass="selectOneMenu">
<f:selectItem itemValue="Open" itemLabel="Open" />
<f:selectItem itemValue="Closed" itemLabel="Closed" />
</h:selectOneMenu></td>
<td style="width:5px" width="2"> </td>
</tr>
</tbody>
</table> <h:messages styleClass="messages" id="messages3" style="color: red"></h:messages>
<br />
<hx:commandExButton id="buttonDoAddOrder_4UpdateAction1"
styleClass="commandExButton" type="submit" value="Add a Record"
action="#{pc_RowActionSelect.doAddOrder_4UpdateAction}">
</hx:commandExButton>
<H4>How It works:</H4>To create a row select column:<BR>1. Open the Properties view for the data table.<BR>2. On the Row Actions tab click "Add Selection Column to the Table".<BR>3. Select the row action check box that appears in the data table.<BR>
4. Bind the column by entering a value in the "Value" field of its Properties view. Use one of the four ways described above to bind the column.<BR>
<BR>
The SDO deletion process can be viewed in the action code for the command-buttons that correspond to each table.
The bean deletion is done by a method call to a JavaBean by the action method. To view the code, select one of the delete buttons, then open the Quick Edit view and look at the "Command" method. This code is not automatically generated and you will need to write your own.<H4>Files
of Interest:</H4>
<UL>
<LI><B>WebContent/rowActions/rowActionSelect.jsp </B>- (This
Page) Where the JSF source code to create these tables and bind
the values is found.</LI>
<LI><B>src/com.ibm.samples.rowActionSelect.RowSelectBean.java</B>
- The Bean where data on selected rows is stored and where the
Bean deletion takes place.</LI>
<LI><B>src/pagecode.rowActions.rowActionSelect.java</B> -
Where the delete button actions are performed. (This can also be
viewed from the Quick Edit view.)</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/rowActions/RowActionSelect.java" --%><%-- /jsf:pagecode --%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -