我在Windows Server中使用Apache tomcat7运行了一个Spring项目(它正常工作),最近将操作系统更改为CentOS7(用于资源问题)。 转换到Linux有一个大问题。 它安装CentOS7并设置相同的配置(tomcat7,jdk 1.7)。 Maven Build in Win10,Eclipse Luna - >在CentOS中部署Root.war,tomcat7 Webapp。 我发送请求,它总是null(request.getParameter(" id"))
我在客户端使用ajax(method:post)并在Contoller中使用@RestController。 当我改变方法以获得'有效。 在这种情况下我很困惑(以前在Windows操作系统中完美运行)。
附加代码:
$.ajax({
url: "/loginCheck",
data: {'uid':uid, 'passwd':passwd},//$("#frm").serialize(),
method: "post",
dataType: "json"
});
@RestController
public class SysController {
@RequestMapping(value = "/loginCheck", method = RequestMethod.POST)
public Map<String, String> loginProc(HttpServletRequest request, HttpServletResponse response) throws IOException {
String uid = request.getParameter("uid");
String passwd = request.getParameter("passwd");
System.out.println("uid=" + uid);
System.out.println("passwd=" + passwd);
Enumeration<String> params = request.getParameterNames();
while (params.hasMoreElements()) {
String paramName = (String) params.nextElement();
System.out.println("Parameter Name - " + paramName + ", Value - " + request.getParameter(paramName));
}
return map;
}
<properties>
<spring.version>4.1.4.RELEASE</spring.version>
<spring.security.version>4.0.2.RELEASE</spring.security.version>
<mybatis.version>3.2.8</mybatis.version>
<mybatis-spring.version>1.2.2</mybatis-spring.version>
<logback.version>1.1.2</logback.version>
<slf4j.version>1.7.5</slf4j.version>
<jackson.version>2.5.2</jackson.version>
<poi.version>3.11</poi.version>
<maven.tomcat.url>http://mold.ubidom.com/manager/text</maven.tomcat.url>
<maven.tomcat.path>/</maven.tomcat.path>
<tomcat.username>pcw</tomcat.username>
<tomcat.password>pcw1234</tomcat.password>
</properties>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>