Deploy Web Application
The sections in this appendix explain how to:
These instructions are for the Windows 64-bit operating system. Similar instructions can be used to install the web server and deploy the web application on other operating systems. You need to install and set up either Tomcat or IIS.
After the web application is deployed using the instructions in this appendix, you can test your web applications from other computers and from your mobile devices, as long as they are connected to the same network as your web server. If you are not able to access your web page on your mobile device, go to the URL locally on your web server. If you can see the page from your server but not from your mobile device, check that:
C-1. Prerequisite: Downloading Java 7 JRE
To download Java 7 JRE:
To verify that Java JRE is installed properly, open the MS-DOS prompt and enter the java -version command. You should see the following output:
java version "1.7.0_60"
Java(TM) SE Runtime Environment (build 1.7.0_60-b19)
Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)
You need to verify that the JRE_HOME environment variable is set properly. Go to Windows operating system’s Control Panel by choosing Systems and Security System Advanced System Settings Advanced tab Environment Variables. If JRE_HOME is not set properly, set it by clicking New:
Variable name: JRE_HOME
Variable value: C:Program FilesJavajre7
C-2. Downloading and Installing Apache Tomcat
To download Apache Tomcat, follow these steps:
At the time of writing of this book, the latest version is 8.0.9. Click on Tomcat 8.0 under the Download section and then click on 64-bit Windows zip (pgp, md5) under the 8.0.9 – Binary Distributions – Core section.
C-3. Starting and Stopping the Tomcat Server
To start the Tomcat web server, follow these steps:
If the prerequisite is met and there is no issue with the setup, you should see the last line of the output as:
13-Jul-2014 19:42:15.347 INFO [main] org.apache.catalina.startup.Catalina.start
Server startup in 577 ms
This indicates that the server has started successfully.
If no MS-DOS prompt window is displayed and the startup.bat file gets terminated immediately, update the startup.bat file with the pause command at the end of the file. This will keep the MS-DOS prompt window open and display the error message.
To stop the Tomcat web server, follow these steps:
C-4. Deploying the Web Application on the Tomcat Server
To deploy the web application on the Tomcat server, follow these steps:
If you can access your page that means your web application is deployed properly.
C-5. Installing IIS (Internet Information Services)
To install IIS, you need to log on with administrator rights. The following instructions are for deploying the web application on IIS 7.0 (or 7.5) under the Windows 8 operating system. Similar instructions can be used for Windows 7 and Windows 2008 server.
Figure C-1. IIS installation status
Figure C-2. Default IIS page
C-6. Deploying the Web Application on the IIS Server
To deploy the web application on the IIS server:
C:windowssystem32inetsrvInetMgr.exe
On the left panel, expand your computer name and choose Sites. Right-click on Default Web Site and then click Add Application.
Figure C-3 displays the Add Application settings. After entering an Alias and a Physical Path, click OK.
Figure C-3. The Add Application settings
If you can access your page that means your web application is deployed properly.
C-7. Accessing a Deployed Web Application
You can deploy your mobile web application on the Tomcat web server (or IIS) and test your web pages on your mobile device by following these steps:
http://192.168.1.72:8080/jQueryLearn/myPage.htm
If the web application is deployed on IIS, use:
http://192.168.1.72/jQueryLearn/myPage.htm
You should be able to see your web page on your mobile device. If you have any issue accessing web pages from the mobile device, check that the web server is running and that the server and the mobile device are connected to the same local router through an Ethernet cable or via WiFi.
3.142.12.207