Listening To Map Event


Purpose This sample shows to use AJAX within a Web ADF Java application. It shows how to send a request to the server using XMLHttpRequest. Use a PhaseListener to process the request and generate the XML response. JavaScript is used to send asynchronous request and parse the XML response to update information displayed on the web page.
 
On zooming and panning the map, the current extent and scale information changes accordingly.

How to use

See How to use ArcGIS samples for help running the sample.

Listening To Map Event
  1. This sample shows to use AJAX within a Web ADF Java 10.0 application. It shows how to send a request to the server using XMLHttpRequest. Use a PhaseListener to process the request and generate the XML response. JavaScript is used to send asynchronous request and parse the XML response to update information displayed on the web page. On zooming and panning the map, the current extent and scale information changes accordingly.
  2. Create and start an ArcGIS map server object. You may use any data, map configuration file, and server object name. If you wish to match the Web application in the Developer Help, create a server object named 'usa' from the map configuration file at %AGSDEVKITJAVA%\java\samples\data\mxds\usa.mxd.
  3. There are two ways to build the sample. You can either use ArcGIS Ant or Eclipse plugin. To use Ant, at command line, browse to %AGSDEVKITJAVA%\java\samples\listeningToMapEvent, type arcgisant build, follow the command prompt to finish the build. There will be a directory called build under the sample root folder, inside there will be a war file. Deploy the war file into Tomcat.
  4. The other way to build the sample is to use Eclipse. Open Eclipse, File - New Project - ESRI Templates - Web ADF Samples.
  5. Choose the Listening To Map Event
  6. Go through the wizard to finish building the sample.
  7. Run the sample web application on server.
  8. You can also export the application as war file and deploy to other supported application server.
  9. Open http://<host>:<port>/<appname>/map.jsf
  10. Zoom into an area of the map such that not too many features are visible
  11. Right click on a layer in toc and select the 'Show Layer Attributes' menu item
  12. This should process your request and display the attributes for all features in that layer currently within the visible extent





Development licensing Deployment licensing
Server Server