7-22 Oracle Fusion Middleware Extending the Administration Console for Oracle WebLogic Server
wl:button-bar
7.4.8.2 Add Check Boxes and Buttons to a Table
To process data on behalf of one or more table rows, use check boxes and a button to post the data to an HTTP request. You must also create a Struts Action or Page Flow
that can retrieve and process the posted data:
1.
To post data to an HTTP request on behalf of one or more table rows:
a.
In your Struts configuration file, add a property named chosenContents to the definition of the tables ActionForm bean.
The data type for this property must be either an array of primitive types or of com.bea.console.handles.Handle
. The wls:table tag adds one element to this array for each check box that
is selected when the user submits the table. For example:
form-property name=chosenContents type=[Lcom.bea.console.handles.Handle;
b.
In the table JSP, add the following attributes to the wl-extension:table tag:
singlechange=false controlsenabled=true
showcheckboxes=true checkBoxValue=property-name
where property-name is the name of a property in the row bean. The data type of this property must match the data type that you have declared for the
chosenContents property.
The wl:table tag adds the value of this row bean to the array in the table beans chosenContents property.
If you want the table to render radio buttons, which allow users to select only a single row, add the following attribute:
singlechoice=true
c.
Immediately after the wl-extension:table opening tag, add the following tags:
wl:button-bar wl:button-bar-button labelid=button-label
portlet=portlet-instanceLabel pageLabel=page-definitionLabel
wl:button-bar
where: button-label
is the text that you want to display on the button or the name of a property that you have defined in the bundle that has been declared in the
JSPs fmt:setBundle element. portlet-instanceLabel
is the label of a portlet instance that contains the Struts Action or Beehive Page Flow that you want to launch when a user clicks
the button. The label is defined in the instanceLabel attribute of the
Using Oracle Templates and JSP Tags 7-23
netuix:portletInstance element, which is in the .book file for the
page that contains the portlet. Instead of immediately launching an Action or Page Flow, you can specify a
portlet that contains a JSP. The JSP can ask users for confirmation before launching an Action or Page Flow.
page-definitionLabel is the unique label of the page that contains the
instance of the portlet to which you want to forward. The label is defined in the definitionLabel attribute of the
netuix:page element, which is in the pages .book file.
2.
To create a Struts Action that can process the posted data:
a.
Create a portlet that forwards to a Struts Action. Make sure that the portlets instanceLabel
matches the value that you specified in step 1c. For example:
netuix:portletInstance markupType=Portlet instanceLabel=medrecMonitor.Tab.Portlet
contentUri=portletsmedrec_monitor_tab.portlet
For information about creating a portlet, see Section 6.1, Define a Portlet.
b.
In your Struts configuration file, define an ActionForm bean that contains a property named chosenContents. The data type for this property must be
the same data type that you specified in step 1a.
For example: form-bean name=processButtonForm
type=org.apache.struts.action.DynaActionForm form-property name=chosenContents
type=[Lcom.bea.console.handles.Handle; form-bean
c.
In your Struts configuration file, define a Struts Action mapping that sends the data in the ActionForm bean to a Java class for processing.
For example: action path=ProcessButtonAction
type=com.bea.medrec.extension.MedrecMBeanButtonAction name=processButtonForm
scope=request validate=false
forward name=success contextRelative=true path=ext_jspbutton_view.jsp
action
7.4.8.3 Example: How Check Boxes and Buttons Process Data