ArcIMS结合struts进行webGIS开发
来源:互联网 发布:单片机上位机软件 编辑:程序博客网 时间:2024/05/08 18:12
(1)在struts中新建一个action
<action-mappings >
<action
attribute="requestMapForm"
input="/index1.jsp"
name="requestMapForm"
path="/requestMap"
scope="request"
type="com.suzhou.struts.action.RequestMapAction" />
</action-mappings>
(2)在map.jsp中新建一个form,对应这个action,记住,struts的<url-pattern>必须设置成*.do的格式(在web.xml中设置),如果设置成/do/*格式,多次请求这个action会出现找不到action的错误。
字串5
<FORM action="requestMap.do" name="requestMapForm">
<INPUT type="submit" value="确定"/>
</FORM>
(3)编写action代码
字串1
代码
package com.suzhou.struts.action;
import javax.servlet.http .HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 字串6
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import com.esri.aims.mtier.io.ConnectionProxy;
import com.esri.aims.mtier.model.map.Map;
import com.suzhou.struts.form.RequestMapForm;
/** */ /** 字串8
* MyEclipse Struts
* Creation date: 03-29-2006
*
* XDoclet definition:
* @struts.action path="/requestMap" name="requestMapForm" input="jspForm.jsp" scope="request" validate="true"
*/
public class RequestMapAction extends Action {
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/** */ /**
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) { 字串5
RequestMapForm requestMapForm = (RequestMapForm) form;
String strAction = requestMapForm.getAction();
ConnectionProxy conn = new ConnectionProxy();
conn.setHost( " menglikun " ); // ArcIMS服务 器的名称或者IP 字串1
conn.setConnectionType(conn.TCP);
conn.setPort( 5300 ); // ArcIMS服务器 的端口
conn.setService( " zixian " ); // 需要调用的ArcIMS服务器的服务名称
conn.setDisplayMessages( false );
// 使用Map对象的访问方式
/**/ /*
Map map=(Map)request.getSession().getAttribute("gongzhongMap");
if(map==null){ 字串7
//如果Map对象为空,新建一个Map对象
map=new Map();
try{
map.initMap(conn,0,false,false,false,false);
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
request.getSession().setAttribute("gongzhongMap",map);
return mapping.getInputForward();
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace(); 字串1
}
}else{
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
request.getSession().setAttribute("gongzhongMap",map);
return mapping.getInputForward();
}
*/
/**/ /*
* 不使用Map对象,直接通过arcXML进行请求的访问方式。
* 这种方式的好处 是可以使用arcXML所有的功能,功能非常强大。
* 但要自己写代码处理arcIMS返回的结果。
*/
String strArcXML = " <?xml version=/ " 1.0 / " encoding=/ " UTF - 8 / " ?> "
+ " <ARCXML version=/ " 1.1 / " > "
+ " <REQUEST> "
+ " <GET_IMAGE> "
+ " <PROPERTIES> "
+ " <ENVELOPE minx=/ " - 13.62 / " miny=/ " 33.91 / " maxx=/ " 53.62 / " maxy=/ " 73.33 / " /> "
+ " <IMAGESIZE width=/ " 600 / " height=/ " 400 / " /> "
+ " </PROPERTIES> "
+ " <LAYER type=/ " acetate/ " name=/ " acetate/ " id=/ " acetate/ " > "
+ " <OBJECT units=/ " pixel/ " > " 字串5
+ " <NORTHARROW type=/ " 4 / " coords=/ " 20 30 / " shadow=/ " 32 , 32 , 32 / " size=/ " 15 / " /> "
+ " </OBJECT> "
+ " </LAYER> "
+ " </GET_IMAGE> " 字串8
+ " </REQUEST> "
+ " </ARCXML> " ;
try {
conn.send(strArcXML);
return mapping.getInputForward();
} catch (Exception ex) {
System.out.println(ex.getMessage()); 字串6
ex.printStackTrace();
}
102 return null ;
103 }
104 }
package com.suzhou.struts.action;
import
import javax.servlet.http.HttpServletResponse; 字串6
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
字串7
import com.esri.aims.mtier.io.ConnectionProxy;
import com.esri.aims.mtier.model.map.Map;
import com.suzhou.struts.form.RequestMapForm;
/** */ /** 字串8
* MyEclipse Struts
* Creation date: 03-29-2006
*
* XDoclet definition:
* @struts.action path="/requestMap" name="requestMapForm" input="jspForm.jsp" scope="request" validate="true"
*/
public class RequestMapAction extends Action {
字串6
// --------------------------------------------------------- Instance Variables
// --------------------------------------------------------- Methods
/** */ /**
字串9
* Method execute
* @param mapping
* @param form
* @param request
* @param response
* @return ActionForward
字串4
*/
public ActionForward execute(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) { 字串5
RequestMapForm requestMapForm = (RequestMapForm) form;
String strAction = requestMapForm.getAction();
ConnectionProxy conn = new ConnectionProxy();
conn.setHost( " menglikun " ); //
conn.setConnectionType(conn.TCP);
conn.setPort( 5300 ); //
conn.setService( " zixian " ); // 需要调用的ArcIMS服务器的服务名称
conn.setDisplayMessages( false );
字串5
// 使用Map对象的访问方式
/**/ /*
Map map=(Map)request.getSession().getAttribute("gongzhongMap");
if(map==null){ 字串7
//如果Map对象为空,新建一个Map对象
map=new Map();
try{
map.initMap(conn,0,false,false,false,false);
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
字串5
request.getSession().setAttribute("gongzhongMap",map);
return mapping.getInputForward();
}catch(Exception ex){
System.out.println(ex.getMessage());
ex.printStackTrace(); 字串1
}
}else{
map.refresh();
request.setAttribute("mapURL",map.getMapOutput().getURL());
request.getSession().setAttribute("gongzhongMap",map);
return mapping.getInputForward();
字串6
}
*/
/**/ /*
* 不使用Map对象,直接通过arcXML进行请求的访问方式。
字串7
* 但要自己写代码处理arcIMS返回的结果。
*/
String strArcXML = " <?xml version=/ " 1.0 / " encoding=/ " UTF - 8 / " ?> "
字串7
+ " <ARCXML version=/ " 1.1 / " > "
+ " <REQUEST> "
+ " <GET_IMAGE> "
字串9
+ " <PROPERTIES> "
+ " <ENVELOPE minx=/ " - 13.62 / " miny=/ " 33.91 / " maxx=/ " 53.62 / " maxy=/ " 73.33 / " /> "
字串8
+ " <IMAGESIZE width=/ " 600 / " height=/ " 400 / " /> "
+ " </PROPERTIES> "
字串8
+ " <LAYER type=/ " acetate/ " name=/ " acetate/ " id=/ " acetate/ " > "
+ " <OBJECT units=/ " pixel/ " > " 字串5
+ " <NORTHARROW type=/ " 4 / " coords=/ " 20 30 / " shadow=/ " 32 , 32 , 32 / " size=/ " 15 / " /> "
字串9
+ " </OBJECT> "
+ " </LAYER> "
+ " </GET_IMAGE> " 字串8
+ " </REQUEST> "
+ " </ARCXML> " ;
try {
字串7
conn.send(strArcXML);
return mapping.getInputForward();
} catch (Exception ex) {
System.out.println(ex.getMessage()); 字串6
ex.printStackTrace();
}
102 return null ;
103 }
104 }
- ArcIMS结合struts进行webGIS开发
- arcims的webgis应用开发
- 《WebGIS开发实践手册》2.6 ArcIMS自定义开发方式
- 《WebGIS开发实践手册》2. GIS服务器ArcIMS
- 《WebGIS开发实践手册》2.1 ArcIMS体系架构
- 《WebGIS开发实践手册》2.2 ArcIMS服务器组件[1]
- 《WebGIS开发实践手册》2.2 ArcIMS服务器组件[2]
- 《WebGIS开发实践手册》2.3 ArcIMS的进程
- 《WebGIS开发实践手册》2.4 ArcIMS连接器和Web ADF
- 《WebGIS开发实践手册》2.5 ArcIMS的管理组件
- [HTML5-SVG]基于SVG技术进行WebGIS开发浅析
- Hibernate和Struts进行完美结合
- struts 应用结合tomcat进行ssl认证
- arcims开发(arcIMS 客户端 连接器的选择)
- ARCIMS 开发经验总结
- ArcIMS 开发学习心得
- arcims开发经验总结(3)
- 结合 Ajax 进行 PHP 开发
- 处理器的状态
- .NET企业级应用架构设计系列之技术选型
- x86系列处理器
- 新版人民币 500元|100元|50元
- csc.exe编译器所有参数详解
- ArcIMS结合struts进行webGIS开发
- 第一次写文章
- 开始我的bolg之旅
- 热烈庆贺孙鑫老师的网站重新开放
- 使用 JTidy 协助抽取网页内容
- ArcIMS体系结构说明
- Oracle安全数据系统架构全接触(1)
- Oracle安全数据系统架构全接触(2)
- 程序设计实践7-----性能