AJAX Postback


Purpose
This sample shows how to integrate the AJAX postback mechanism within a WebADF Java application. Upon page initialization, postback handler which is to process postback response for xml tag <map-information-2> is registered with EsriControls. <map-information-2> tag is generated by an AJAXRender bean on the server. The JavaScript is also responsible to update page content for the coordinates and map scale.
 
When you zooming or panning the map, the current extent and scale information changes.

How to use

See How to use ArcGIS samples for help on running the sample. If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

AJAX Postback
  1. This sample shows how to integrate the AJAX postback mechanism within a WebADF Java 10.0 application. Upon page initialization, postback handler which is to process postback response for xml tag <map-information-2> is registered with EsriControls. <map-information-2> tag is generated by an AJAXRender bean on the server. The JavaScript is also responsible to update page content for the coordinates and map scale. When you zooming or panning the map, the current extent and scale information changes.
  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\ajaxPostback, 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 AJAX Postback sample.
  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. After deployment access the sample by typing the URL (e.g. http://[host]:[port]/[samplename]) in a web browser.
  10. On zooming and panning the map, the current extent and scale information changes.


Download the files for Java
mapInformation2.jsp JSP page that lays out the controls on the page and the table to display the map information
mapInformation2.js Javascript functions to process postback response for xml tag 'map-information-2' and update content on the page
fc-mapInformation2.xml Declares the AJAXRenderer managed bean
JavaSource\com\esri\arcgis\sample\mapinformation2\MapInformation2Renderer.java AJAXRenderer to render xml tag 'map-information-2' with extent and scale information




Development licensing Deployment licensing
Server Server