Pavel has posted 2 posts at DZone. View Full User Profile

iPFaces Mobile Application Framework - How to Start?

02.22.2010
| 4843 views |
  • submit to reddit

iPFaces is a flexible solution for easy development of form-oriented network mobile applications. With the iPFaces solution, mobile devices are able to render content received from a server using their native UI components. It uses thin presentation client (must be installed on device) to render application content. Using iPFaces it is possible to build an application where users can use their device's specific component behavior and additional device features, such as location service and additional graphic components of the device (lists, pickers etc.).

iPFaces doesn't work only with Java, but also PHP and ASP.Net are supported.

Architecture

The solution is based on the use of a thin presentation client installed on the device and an application/web server which generates the content for clients. The client and the server communicate with each other using the network.
The idea is similar to the web browser – web server model. The client sends HTTP(S) requests to the server and receives iPFaces specific HTTP(S) responses, where the content is an XML representation of the application's form which is be rendered on client-side together with the form's data.

Archicture of iPFaces Mobile Application Framework

How to start?

Development of a complex iPFaces application is really simple because the simulation mode can be used. This mode is capable of transfering XML content to a HTML page, which can be displayed in a web browser. It is a helpful tool for developers who can see their iPFaces application in the browser window and they do not need a real iPhone device for main development. Developers can build and deploy an application to the application server and the browser will show them the GUI which is almost the same as a screen in an iPhone application. There is a difference in the GPS elements. A GPS field is working in a browser only as text field that can be filled by user and GPS coordinates will be submitted. The GPS field is hidden on mobile devices, because the location of the device is detected without interaction with the user.

Hello World example

Add “ipfaces-taglib-1.1. jar“ to your web project. For development, it is suitable of have the “ipfaces-taglib-1.1.jar” library in the development environment listed in the project “CLASSPATH”.

<%@ taglib prefix="ipf" uri="http://www.ipfaces.org/tags" %>
<ipf:form>
<ipf:screen title="Hello World Application">
<ipf:label text="Hello World!"/>
</ipf:screen>
</ipf:form>

Then create the WAR web application bundle through the preferred path and deploy “Hello World” to your application test server in a standard manner.

Preview of Hello World App

Use of location service

To obtain a user location from a mobile device use the IPFGsm class. Upon submission of a form, the location data will be sent as a parameter with the selected name (gpsElement in this example). 

<%@ taglib prefix="ipf" uri="http://www.ipfaces.org/tags" %>
<ipf:form action="distance.htm">
<ipf:screen title="How Far Is It?">
<ipf:label text="Find distance to the selected city." />
<ipf:select icon="/img/distcalc.png" name="selectedCityId"
type="list" title="Distance to">
<ipf:options items="${cityList}" itemValue="id"
itemTitle="name" />
</ipf:select>
<ipf:button title="Calculate" type="submit” position="forward" />
<ipf:gps name="gpsLocation" />
<ipf:button action="/main/menu.htm" type="link” title="Examples"
position="back" />
</ipf:screen>
</ipf:form>

 


Preview of App with GPS Module
AttachmentSize
image01.png67.75 KB
image04.png7.36 KB
image06.png76.4 KB
Published at DZone with permission of its author, Pavel Strzinek.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)