ItemsDBControl.jcx Sample

This topic inludes the source code for the ItemsDBControl.jcx Sample.

Sample Location

This sample is located in the following directory in your WebLogic Workshop installation:

BEA_HOME/weblogic81/samples/workshop/SamplesApp/WebApp/tagSamples/netui_databinding/declarePageInput/

Sample Source Code


01 package tagSamples.netui_databinding.declarePageInput; 
02 
03 import com.bea.control.*; 
04 import java.sql.SQLException; 
05 
06 /** 
07  * Defines a new database control. 
08  
09  * The @jc:connection tag indicates which WebLogic data source will be used by 
10  * this database control. Please change this to suit your needs. You can see a 
11  * list of available data sources by going to the WebLogic console in a browser 
12  * (typically http://localhost:7001/console) and clicking Services, JDBC, 
13  * Data Sources. 
14  
15  * @jc:connection data-source-jndi-name="cgDataSource" 
16  */ 
17 public interface ItemsDBControl extends DatabaseControl, com.bea.control.ControlExtension
18 
19     static public class Item
20     {
21         public int itemnumber;
22         public String itemname;
23         public int quantityavailable;
24         public double price;
25     }
26     
27     static final long serialVersionUID = 1L;
28 
29     /**
30      * @jc:sql statement="SELECT ITEMNUMBER, ITEMNAME, QUANTITYAVAILABLE, PRICE FROM ITEMS"
31      */
32     Item[] getAllItems() throws SQLException;
33 }