Web Mapping Applications made easy with Eclipse ArcGIS plug-ins

In this post we will discuss how to install and set up the ESRI Java Web ADF plug-in using Eclipse Ganymede. Once, we have the plug-in installed, we will set out to use the features by creating a Web Mapping Application (WMA) and extend our WMA with a Query Task functionality. 

Setting Eclipse ArcGIS Preference

Before beginning any project, it can be useful to set up common preferences for the new project wizards. Click Window > Preferences from the main menu in Eclipse. Select ArcGIS > Server from the left panel of the dialog box. The connection information entered here will be used by the project wizards. You can specify information needed to connect to some of the more commonly used servers such as ArcGIS Server, ArcIMS, and ArcGIS Web services. Each time you are prompted to add a data source, it will be automatically pre-populated with these values. 

You can also check the box to Show New Project Wizard Advanced Options. This will provide a couple of extra steps in the wizard for further customization if needed. By default this is unchecked. 

Setting up an Eclipse Server Runtime with Tomcat

In order to test and publish web applications on your application server through Eclipse, you need to define one or more resources by installing the application server and installing the appropriate server runtime in Eclipse.  Although you can set up any supported application server which supports Eclipse server runtimes, in this example we will publish our WMA to Apache Tomcat.  Once installed, it is also important to make sure that Tomcat is set to use a 1.5.x or higher JDK.  You should check by using the Configure Tomcat shortcut from the Tomcat install to display the properties dialog below. Click the Java tab and make sure the Java Virtual Machine is set to a jvm.dll located in a 1.5.x JDK. 

More information about using Tomcat in Eclipse can be found on the Eclipse wiki.  

To set up Tomcat server runtime in Eclipse, there are a few simple steps:

  • Click Windows > Preferences from the Eclipse toolbar. In the Preferences dialog box, expand the Server option and select Installed Runtimes. Click the Add button.
  • Navigate to the appropriate Apache Tomcat server and click Next.
  • Click the Browse button and locate the Tomcat installation directory on your file system. Click the Installed JREs button to add a JDK as the default JRE.  Check an appropriate JDK or click Add and browse for a JDK. Click OK to close the Preferences dialog box.
  • The dialog box appears as follows. Click Finish. Your Tomcat Server runtime is ready to be used when creating new projects.

Install ArcGIS Server for Java Web ADF plug-in
This section contains instructions on how to install/update the plug-in from ESRI update center.

  • Select Help > Software Updates > from the Eclipse toolbar (1) if you have an ArcGIS Eclipse Plug-in installed and are upgrading.  Click the Installed Software tab, find ArcGIS Core and ArcGIS Server entry, right click on each and choose Update. Eclipse will go to the pre-defined update site to get the latest plug-ins. (2) If this is your first time installing the ArcGIS Server for Java Eclipse plug-in, click the Available Software tab, and click the Add Site button on the right.
 
  • Next, click the Local button to browse to the plug-in location on disk, make sure to browse to the Server folder level in your ArcGIS Server for Java directory.
  • You should now see ArcGIS added to the available software list. Check ArcGIS Core and ArcGIS Server and click Install. Once installation is complete, click Finish and follow the prompt to restart Eclipse by clicking OK.

Create a new ArcGIS Web ADF project
This section contains instructions for creating a new Eclipse project based on ESRI Web Project Template.

  • Create a new project by clicking File > New > Project and choose ESRI Web Project under ESRI Templates. Click Next and give your project a name.
  • Make sure to choose a Target Runtime, for example, the Apache Tomcat server runtime we set up in previous steps.
  • In the New ArcGIS Web Project Window, double click Add GIS Server node.

 

  • Enter the server connection credentials and click OK.  This should be pre-populated with the credentials set in the preferences dialog. 

 

  • Choose a service from the list and add it to the webcontext. Click Finish to complete.
  • Right click the project name in the Project Explorer panel, Run As > Run on Server. Pick a server and hit Finish. To view the site in an external browser, go Window > Web Browser, choose anyone other than the Internal Web Browser.

At this point, you should have a WMA running with all the default features offered by the plug-in.  In our next section, we will add a Query Task to the WMA and test it again.   

Add a query task
This section contains instructions on how to add a query task to the web application.

  • In the right hand project file list, expand your project to open the mapviewer.jsp under WebContent. Once the source opens up, scroll down to the line where it says <a:task id=”searchAttributesTask” . . .> (this is typically around line 123). 
  • Place your cursor in front of this line and right click ArcGIS > Add Task > Query Attributes …

 

  • Now configure the query task. Click the Settings tab, pick a Map Service and pick a layer. Next to Query Expression, click Add.
  • In the New Expression window, pick a Field to query against and either type in the value to query or select from a list of sample values. Click OK, and OK on the Add Query Task window.
  • Inspect your extended mapviewer.jsp source file.  You should see the query task added and the query link added to the task menu bar.
  • Run the application again and test your query task.

You now have a WMA with an extended Query Task enabled all without writing a single line of code.  The ESRI ArcGIS Server for Java plug-in hides the complexity of many features which enables you as the developer to quickly create production quality web mapping applications. 

Contributing Author, Li Linn, ESRI Java Development Team

This entry was posted in Developer and tagged , , , , . Bookmark the permalink.

Leave a Reply

2 Comments

  1. patel1684 says:

    i does not have tomcat server
    so how i can configure eclipse with arc gis desktop 10 for java development
    please send me details

  2. eric906 says:

    For Java development of Desktop Addins, extensions, custom gp tools, VisualBeans Engine apps, etc, there is no need to have Tomcat in the mix. All you need to have available is simply the Arcobjects Java SDK, the same one mentioned in this blog, and the eclipse plugins that come with it was well as ArcGIS for Desktop or the Engine Runtime.

    Hope this helps.