jspForm.jsp
上传用户:gzuoyue
上传日期:2022-07-08
资源大小:177k
文件大小:2k
源码类别:

GIS编程

开发平台:

ASP/ASPX

  1. <%@ page language="java" buffer="8kb"  %>
  2. <%@ page import="com.esri.aims.mtier.io.ConnectionProxy" %>
  3. <html>
  4. <head>
  5. <title>JSP Form</title>
  6. <%
  7. /**
  8.    * Creates a new instance of The AppServerLink Object.
  9.    */
  10.   ConnectionProxy mcp = new ConnectionProxy();
  11. String arcxmlRequest = request.getParameter("ArcXMLRequest");   //ArcXML request to be sent
  12. String jsFunction = request.getParameter("JavaScriptFunction");
  13. String serverName = request.getParameter("ServerName");
  14. String serviceName = request.getParameter("ServiceName");
  15. String connectType = request.getParameter("ConnectType");
  16. if (connectType==null) connectType = "tcp";
  17. String theResponse = "";
  18. String httpURL = "";
  19. out.println("<script language='JavaScript' type='text/javascript'>");
  20. out.println(" function passXML() {");
  21. out.println("   // ArcXML Response packaged here.");
  22. if (arcxmlRequest != null) {
  23.     if (connectType.equals("tcp")) {
  24.     mcp.setConnectionType(ConnectionProxy.TCP);
  25. mcp.setPort(5300);
  26.   mcp.setHost(serverName);
  27. } else if (connectType.equals("https")) {
  28. if (serverName.indexOf("http")==-1) {
  29. httpURL =  "https://" + serverName;
  30. }
  31. mcp.setConnectionType(ConnectionProxy.HTTP);
  32. mcp.setUrl(new java.net.URL(httpURL));
  33. } else {
  34. if (serverName.indexOf("http")==-1) {
  35. httpURL =  "http://" + serverName;
  36. }
  37. mcp.setConnectionType(ConnectionProxy.HTTP);
  38. mcp.setUrl(new java.net.URL(httpURL));
  39. }
  40. mcp.setService(serviceName);
  41.  
  42.      theResponse = mcp.send(arcxmlRequest);
  43. //out.println(theResponse);
  44. out.println(" var f = document.forms[0];");
  45. out.println(" var xmlResponse = f.ArcXMLResponse.value;");
  46. out.println(" " + jsFunction + "(xmlResponse);");
  47. out.println(" return true;");
  48. }
  49. out.println(" }");
  50. out.println(" var connectType='" + connectType + "';");
  51. out.println("</script>");
  52. %>
  53. </HEAD>
  54. <BODY BGCOLOR="#000000" TEXT="#000000" onload="passXML()">
  55. <h3>Response Form</h3>
  56. <P>
  57. <FORM ACTION="jspForm.jsp" METHOD="POST" name="theForm">
  58. <INPUT TYPE="Hidden" NAME="ArcXMLRequest" VALUE="">
  59.  
  60. <INPUT TYPE="Hidden" NAME="JavaScriptFunction" VALUE="parent.MapFrame.processXML">
  61. <INPUT TYPE="Hidden" NAME="ServerName" VALUE="">
  62. <INPUT TYPE="Hidden" NAME="ServiceName" VALUE="">
  63. <INPUT TYPE="Hidden" NAME="ConnectType" VALUE="tcp">
  64. <P>
  65. ArcXML Response:<BR>
  66. <textarea name="ArcXMLResponse">
  67. <%
  68. if (arcxmlRequest != null) {
  69. out.println(theResponse);
  70. }
  71. %>
  72. </textarea>
  73. </FORM>
  74. </BODY>
  75. </HTML>