Getting Started with SmartGWT Server DataSoruce Intergration
This is a brief overview of the common steps required to setup SmartGWT EE and how the artifacts required for server side DataSources tie together.
- Define your XML DataSource defintion and place it under WEB-ROOT/ds/
- Create a server.propreties file that contains configuration properties for various SmartGWT EE features. For example if you're using
a Relational DataSource Connector, you would need to specify the database information in this properties file. The property project.datasources
tells SmartGWT EE where to look for the datasource defintions. We would set it to
project.datasources: $webRoot/ds
since that is where
we placed our DataSource definion in the previous step.
- In your web.xml you declare various servlets that enable SmartGWT EE functionality. The distribution contains a skeleton
project under the "skeleton" directory. You can also exampine on of the standaonle samples incuded in the distribution. These samples
have a gwt-maven build file along with a README.txt with information on how to build / run each sample.
-
We now load the DataSource defintion to the client by including the followling line in the body of your GWT host html file.
<script src='sc/DataSourceLoader?dataSource=employees,supplyItem'></script>
Specify a comma separated list of DataSource ID's for the dataSource
parameter. The above line would load the employees and supplyItem
datasources from the server.
-
Thats it. We can now load the DataSource declared on the server into to client by calling
DataSource dataSource = DataSource.get("supplyItem");
and assign it to any SmartGWT DataBound component
You can view the source for each example in this Showcase to see the code and configuration specific to each integration option but
the above are the overall steps that are carried out by the samples. Please note that the samples are were written to be easly to follow and
highlight the key features and API's. We expect users to take the concepts and sample code and apply it the thier architecture.