facebook

Scaffolding Spring Apps for iPhone

This tutorial walks you through the generation of software components for use on the iPhone. This results in a fully implemented ready-to-run iPhone application that can be immediately used for validating and testing the generated iPhone components. In this tutorial, you will learn how to:

  • Scaffold from database tables into an existing project
  • Deploy the app
Spring scaffolding for iPhone requires a MyEclipse Spring or Bling subscription.

1. Create a Web Project

Create a MyEclipse Web project called CustomersiPhoneApp.

Note: If you get a popup regarding the project compiler compliance level not matching the workspace default, specify that you want to use a custom setting for the project by clicking Yes.

New web project


2. Scaffold from Database Tables

Scaffolding for iPhone requires the same steps as scaffolding with Spring MVC. Follow the steps in Scaffolding a Spring MVC Application with the following exception:

Select the Generate checkbox for iPhone on the Select Web Client Type wizard page.


Selecting the Spring iPhone web client

Note: If you want to use the Spring DSL, then you need enable the project for Spring DSL support prior to scaffolding. See Enabling and Using Spring DSL for more information.


3. Deploy the App and Test in the Simulator

  1. Right-click the MyEclipse Tomcat server in the Servers view, and select Add/Remove Deployment.
  2. Select CustomersiPhoneApp in the Available column, click Add, and click Finish.

    Adding a project to the server
  3. You can use a mobile emulator to test your app. Enter the following URL in the address bar: http://localhost:8080/CustomersiPhoneApp/.

The iPhone application can be used to list all customers, view customer details, edit customer details, delete customers and add new customers.

Customer app list
Customer app edit details


4. What’s Generated?

To ease your way into code generation with ME4S, this tutorial involved scaffolding from only a single database table. Therefore, only the software components for managing a single entity were generated, and there were no entity relationships. When you start generating for multiple entities, potentially with entity relationships, there are many more software components generated than were generated with this tutorial. Even though there’s a lot more code, it is grouped and organized as shown in the following  images.

Generated scaffolding