Posts Tagged ‘iPhone development’

Mobile Spring-Based Web Apps for Everyone

Monday, August 9th, 2010

One of the snappy new features in MyEclipse for Spring 8.6 is the ability to scaffold a web application that’s skinned to look like an iPhone app.  The generated app runs on a web server and uses a Spring back-end.  But, what about the oodles of people who don’t use iPhones or the brilliant developers who know that smartphone names don’t always start with the letter i?

Well, that’s where this article comes in.  I will show the MyEclipse for Spring user how to convert their fancy iPhone app to an ultra-fancy mobile app that will look smashing on any smartphone that has a reasonable screensize. When you’re finished with this article you will have a running application customized not only for your immobile desktop, but also your Android phone, your sister’s Palm Pre and your cube-mate’s iPhone.

iPhone to Palm

The Goal

There are three steps necessary to achieve our goals today.  First, we’ll scaffold an iPhone app.  Then we’ll duplicate our iPhone pages and update their CSS to be less iPhone-ish.  Finally, we’ll apply a little dab of Spring glue necessary to make those new cooler pages show up on some other smartphones.  As a final but optional step, you can brag to your co workers about how smart you are now that you’ve done this.  Enough with the formalities, let’s get started.

Step 1 – Scaffold the iPhone application

In this example we’ll scaffold a Spring MVC front-end along with the iPhone front-end but in real life you could choose to scaffold any of the cool technologies supported by MyEclipse for Spring like MVC, GWT, Flex or Web Flow.  There is also no requirement that you scaffold anything but the iPhone.  Since we want an application that shows everyone how smart and flexible we are, we’re going to do Spring MVC and iPhone.

For this example, we’re going to scaffold a very simple task management system from a basic Java class.

package com.tasks.domain;

public class Task {

private String name;
private String description;
private String taskType;
private Boolean isDone;

}

  1. Create a MyEclipse Web Project named TaskManager.
  2. Create a com.tasks.domain package.
  3. Save the Task Java Bean into the new package.
  4. Right-click on the project and select MyEclipse > Scaffold Spring CRUD Application…
  5. On the scaffolding wizard, select Java Beans and press Next.
  6. Pick our Task bean and press Add.  Then press Next.
  7. On the Select Primary Keys panel, select the Task bean and pick the name field as the primary key.
  8. Fast forward until you get to the Select Web Client Type panel.
  9. On the Select Web Client Type panel, pick Spring MVC and iPhone and press Next.

Select Client Types

On the Customize User Interface panel you can specify better labels for fields that appear on the generated JSP pages.   You can also configure which fields will appear in the lists. We want a simple list on our iPhone version so un-check the “Propagate changes to all web client types” checkbox and un-check the all but the “Name” field under the iPhone section. You can also customize the labels if you like.

Customize User Interface Panel

Press Finish when you’re done customizing your labels, then sit back and take a sip of coffee while MyEclipse for Spring generates your DAO Service, Controller, JSP’s and spring configuration files for your mobile and desktop task management system.

At this point, you could deploy the project to your local Tomcat server and access it using your favorite desktop browser.  If you do that, you’ll notice that the application is the standard Spring MVC application generated by MyEclipse for Spring. The dashboard page contains the launch pad to your Spring MVC page and also a note about your iPhone app.

Dashboard

If your Tomcat server is on the web or accessible via Wi-Fi, you can grab your buddy’s iPhone and hit the main page to see the iPhone version.  If you don’t have an iPhone handy or your buddy is too busy playing Chat Roulette on his, take a look at the MobiOne product from Genuitec.  A third option is to download Safari and spoof the user agent string.

Safari Tip: Enable the Develop menu on the Advanced tab of the Preferences panel.  Then on the menu button for the current page, select Develop > User Agent > Mobile Safari – 3.1.3 – iPhone

Regardless of the tool used, once you’ve accessed the iPhone application with a browser that supplies an iPhone user agent string, you’ll see the iPhone version of the application.

iPhone Dashboard - in MobiOne

iPhone Dashboard - in MobiOne

On the following pages we’ll use this iPhone app as a starting point for our non-iPhone mobile web application.

If You Can Use PowerPoint, You Can Build an iPhone App

Friday, July 2nd, 2010

If you have the mouse skills to lay out a decent PowerPoint slide, you have all the know-how necessary to build an iPhone application.

Shenanigans! Tomfoolery! Pure insanity!
(You might be heard to say)

But building iPhone Apps really can be that simple. So simple even we marketing and communications-types can do it. No technical know-how required. Just like PowerPoint can be a powerful and simple presentation layout tool, MobiOne simplifies and drives iPhone applications with drag-and-drop ease. Even design a Web App, test it and send it directly to your phone in about 2 minutes.

Oh yeah, MobiOne is even free in the Milestone stage. There’s no excuse to put off your mobile strategy any longer. Try it now.

Leave your thoughts in the MobiOne support forums or here, Genuitec staff will get back to you.

Cheers!

Mobile Web Frameworks Multiply Like Rabbits

Wednesday, September 23rd, 2009

Just one year ago there were only a handful of pseudo-legitimate mobile Web frameworks and none were well known in the mobile development community. A year later, we find the landscape for mobile Web developers has grown dramatically and is now loaded with frameworks for developers to choose from. Before I go on, let me briefly define what a software framework is and the two type of mobile Web frameworks that have emerged.

Framework Explained
A software framework is a micro-architecture of all or a portion of an abstract application. A frameworks provides patterns of operation and integration, services and conventions for direct use and extension by the developer. In the mobile Web space, two type of frameworks have emerged over the last year or so. They are  a) the UI framework and b) the application framework.

UI Frameworks
A mobile Web UI framework is used for creating mobile Web user interfaces. This type of framework provides a developer Web widgets, look-and-feel styling and event model, to name a few. The framework’s programming model: HTML, CSS3 and JavaScript. Many of these frameworks provide very high-end native look-and-feel capabilities. For example, imagine an iPhone mobile Web application that looks as good as native Objective-C iPhone app.

The following are some of the UI frameworks available:

Mobile Web UI Frameworks

o iUI
o iWebKit
o JQTouch
o Magic Framework
o WebApp.Net
o WidgetPad
o xUI

Application Frameworks
A mobile Web application framework differs from a UI framework in that its primary benefits are services, such as an application packaging model, JavaScript APIs for accessing device services and sensors, e.g., accelerometer, camera, contacts, local database, etc. In some cases, the framework API is portable across different mobile platforms, e.g., iPhone, Android, RIM.

The following are a some of the more well-known mobile Web app frameworks:

Mobile Web Application Frameworks

o Appcelerator
o Big5
o NimbleKit
o OpenConnect
o PhoneGap
o Rohmobile

If you’re confused where to start; you’re not alone.

Our mobile team has been researching a number of these frameworks and will be reporting their findings here over the next few months. Stay tuned.