我使用JDBC连接器的MySQL查询得到了一个结果集.所以我的工作是将结果集转换为JSON格式.这样我就可以将它作为AJAX响应发送到客户端.有些人可以解释如何转换为JSON格式,因为我不熟悉Java以及JSON的概念
xml文件位于WebContent/WEB-INF/web.xml我的项目中.我正在使用Eclipse并运行Tomcat(它不是通过Eclipse安装的.我更喜欢它是一个单独的安装).
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>EmployeeManagement</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<context-param>
<param-name>name</param-name>
<param-value>Pramod</param-value>
</context-param>
<servlet-mapping>
<servlet-name>Registration</servlet-name>
<url-pattern>/EmployeeManagement/WebContent/Registration</url-pattern>
</servlet-mapping>
</web-app>
Run Code Online (Sandbox Code Playgroud)
当表单页面提交给servlet时它不起作用.我每次都会收到404错误.我一直遇到这个问题.有人请帮帮我.