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.
Upload Download
- This sample shows the usage of the download and uploads framework which was built into WebADF Java 9.3. In the download JSP page, there is a tool button to add points, click few points on the map, and then click the “Download Points” button to save the points as a text file. In the upload JSP page, there is an “Upload Points” button, click on it to browse to the saved text file. The previously added points will be brought up. This sample uses the UploadUtil and custom managed bean to store and retrieves data via a text file. It changes the default download.jsp page so that the downloaded file extension is text. The upload and download utility classes are used in conjunction with the Upload and Download Servlets. When downloading, the download bean iterates through the points in the web graphics of the web context, and then generates a comma separated file. When uploading, the upload bean parses the points stored in the uploaded file and add them to the web graphics.
- Create and start an ArcGIS map service. 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.
- 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\uploadDownload, 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.
- The other way to build the sample is to use Eclipse. Open Eclipse, File - New Project - ESRI Templates - Web ADF Samples.
- Choose the Upload Download
- Go through the wizard to finish building the sample. Run the sample web application on server.
- Open http://<host>:<port>/<appname>/fileDownload.jsf
- You can also export the application as war file and deploy to other supported application server.
- Zoom into a desired area of the map
- Set current tool as 'Add point' and add several points to the map
- Click 'Download Points' button to save the added points as a comma separated file
- Save the file to a desired location
- Click 'Download Points' button and when prompted.
- This will save the coordinate of the points to a txt file on your machine.
Download the files for Java
map.jsp | Contains AddSourceTask componenet |
JavaSource\com\esri\arcgis\sample\upload\PointTool.java | Map tools implementation to add points to web graphics |
JavaSource\com\esri\arcgis\sample\upload\DownloadBean.java | Converts points on web graphics to byte representation downloadable file. |
JavaSource\com\esri\arcgis\sample\upload\UploadBean.java | Class to parse points from comma separated file. Then convert these points to web graphic elements and add these points to the web graphics. |
Development licensing | Deployment licensing |
---|---|
Server | Server |