Dynamic Layers in pooled Server Objects


This sample is an extended MapViewer template web application that demonstrates how to add layers dynamically to a pooled Server Object running in the ArcGIS Server. Before building and running this sample, a MapServer object called "USA" must be running on the server.

Server: Java

Platforms: Windows, Solaris, Linux

Minimum ArcGIS Release: 9.0

How to use:
  1. Open a command window.
  2. Navigate to $samples/Server_Development/Web_Applications/DynamicLayers/Java
  3. type jar -xvf dynamiclayers.jar
  4. For this sample to work properly, you will need to edit a properties file called and enter the layer names and shapefile paths for each layer you will want to add to the map dynamically. After unjarring the sample jar, navigate to WEB-INF/classes/com/esri/arcgis/webcontrols/test and edit the file.
  5. Re-jar the sample. Navigate back up to $samples/Server_Development/Web_Applications/DynamicLayers/Java and type jar -cvf dynamiclayers.jar *
  6. Type, arcgisant build
    Note: The location <ArcGIS_install_directory>/DeveloperKit/tools/ant/bin should be in your system path.
  7. Enter the name of your ArcGIS Server and domain/username/password of a valid ArcGIS Server user.
  8. Press Check Connection to check your connection to the ArcGIS Server.
  9. Press OK
  10. Deploy the war file created under the folder /dist to your application server.
  11. Run the application by typing the URL http://<webserver_host>/<application_name>/index.html
  12. In the application, select a layer name from the pulldown list, select a layer position from the pulldown list where the layer will get placed in the layer stack, and hit the AddLayer button. The layer will be added to the Map and the Toc will be updated. You will notice that on subsequent pans and zooms the symbology will change. This is because the layer is being removed and added each time, and the symbology is not being remembered, or passed back and forth. This is an implementation-specific detail, and not within the scope of this sample.>

File Description
mapviewer.jsp JSP page to display a map.
AddLayer.Java Adds layers dynamically to the pooled MapServer object Provides a container for the spcified layers to be added to the pooled MapServer object

Feedback Send feedback on this sample