You can generate an application that uses Java and a SQL database. To generate this type of application, you must have a local Java application server and access to a target SQL database table. You can generate an application that uses a Java servlet to access a database and return data to the Flex application; or if you have LiveCycle Data Services ES, you can choose to generate an application that uses the data management service to access a database and dynamically distribute data to and from clients.
Generate J2EE application code
1. If you have not already done so, create a new Flex project that specifies Java 2 Enterprise Edition (J2EE) as the application server type.
2. Select Data > Create Application from Database.
3. From the Project list, select the J2EE project to use.
4. From the Connection list, select a database connection profile. To create and use a new connection profile, click the New button and complete the text boxes.
5. From the Table list, select the database table to use.
6. From the Primary Key list, select the primary key of the database table.
7. Click Next.
8. To use a specific Java package for the Java classes that will be generated, enter the package name in the Java Package text box.
9. By default, the names of the generated Java classes are prefixed with the name of the selected database table. To use a different prefix, enter it in the Class Name Prefix text box.
10. If your project uses LiveCycle Data Services ES, select whether to use LiveCycle Data Services ES or XML over HTTP for communication between the client and the server. If you select LiveCycle Data Services ES, the Data Management Service is used. If you select XML over HTTP, a servlet passes XML between the client and the server.
11. Click Next.
12. (Optional) Deselect any of the listed table fields to exclude them from the generated Flex DataGrid control.
13. Click Finish.
14. Select Run > External Tools > Run As > Run on Server.
15. Select Run > Run to run the application on the server.
Directory structure and deployment considerations for J2EE
The Flex Builder project's WebContent directory contains directories to be deployed into the root directory of the web application. Depending on the type of Java application server, the web application is deployed as a WAR file or, as is the case with Tomcat, as a linked web application directory. The Flex Builder project's src directory contains Java source files for classes that are deployed to the WEB-INF/classes directory of the web application. For projects that are compiled with Flex Builder, the contents of the Flex Builder project's bin and flex_src directories are included in the list of files that are deployed to the web application; however, the compiled SWF files are deployed rather than the corresponding MXML files that are in the flex_src directory. All of the files in those folders are deployed to the root of the web application.
No comments:
Post a Comment