Tutorial: How to create mobile app in Java

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 way.

Hello world app on the iPhone device and in a web browser

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>
 

iPFaces mobile application framework

Application with GPS Module on the iPhone device.


More examples

To see complex examples in Java, please visit our section Examples.