Web services 使用Axis和Tomcat从JSP页面连接到Web服务
我正在尝试访问我在EclipseIndigo中创建的web服务。我已经创建了所有文件、类和Wsdl文件。下面是我的index.jsp,这里发生的事情是我根据所选的案件和法院返回一家律师公司。但我没有找到的是如何通过动态页面(即JSP页面)连接到它们。非常感谢您的建议Web services 使用Axis和Tomcat从JSP页面连接到Web服务,web-services,jsp,tomcat7,axis2c,Web Services,Jsp,Tomcat7,Axis2c,我正在尝试访问我在EclipseIndigo中创建的web服务。我已经创建了所有文件、类和Wsdl文件。下面是我的index.jsp,这里发生的事情是我根据所选的案件和法院返回一家律师公司。但我没有找到的是如何通过动态页面(即JSP页面)连接到它们。非常感谢您的建议 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO- 8859-1"%> <%@ page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"pageEncoding="ISO- 8859-1"%>
<%@ page import="java.net.URL,javax.xml.namespace.QName,java.net.URL,,javax.xml.ws.Service,org.lao.ws.Findlawyers;"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Law Courts Home Page</title>
</head>
<body>
<form action="index.jsp" method="get">
<select name="selectcourt" id="selectcourt">
<option value="concourt">Constitutional Court</option>
<option value="highcourt">High Court</option>
<option value="magcourt">Magistrates Court</option>
<option value="supremecourt">Supreme Court</option>
</select>
<input type="radio" name="Case Type" value="casecivil" id="CaseType_0" />
Civil</label>
<br />
<label>
<input type="radio" name="Case Type" value="casecriminal" id="CaseType_1" />
Criminal</label>
<%
String casetype = "";
String selcourt = "";
String lawyers = "";
%>
<%=lawyers %></th>
</form>
</body>
</html>
法院主页
宪法法院
高等法院
裁判法院
最高法院
公民的
罪犯
您可以通过两种方式完成,一种是将表单(jsp标记内容除外)发送到servlet并在新页面上显示律师,另一种是使用ajax将所选参数传递给servlet并在同一页面上显示结果
另外,因为您似乎是新手,所以最好尝试我的第一个选项
<form action="index.jsp" method="get">
<select name="selectcourt" id="selectcourt">
<option value="concourt">Constitutional Court</option>
<option value="highcourt">High Court</option>
<option value="magcourt">Magistrates Court</option>
<option value="supremecourt">Supreme Court</option>
</select>
<input type="radio" name="Case Type" value="casecivil" id="CaseType_0" />
Civil</label>
<br />
<label>
<input type="radio" name="Case Type" value="casecriminal" id="CaseType_1" />
Criminal</label>
</form>
String casetype = request.getParamter("Case Type");
String selcourt = request.getParamter("selectCourt");
然后使用它从数据库中查找数据
然后查询在查询中使用这些参数并获得所需的结果。感谢您的响应。但是我不需要重放你所说的wat值吗?我的意思是,既然我正在使用表单,我是否需要包含servlet名称,比如而不是action=index.jspu也可以使用index.jsp,但不是gud方式……毫无疑问,它会给你带来d结果……因为你使用index.jsp……你可以尝试一下,但以后最好使用servletshope,你知道从数据库进行查询吗?