java - 客户端发送的请求在语法上错误

标签 java spring-mvc

我正在向 Controller 发布一个 JSON 对象,它显示 404 错误和消息“客户端发送的请求在语法上不正确。”

<html>
<form action= "action" method="post">
    <input type ="text" name="user.name"/>
    <input type ="text" name="user.pwd"/>
</form>
</html>

并在 Controller 中捕获

@RequestMapping(value = "/action", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
        public @ResponseBody
        public void createuser(@RequestBody UserDTO request,
                HttpServletRequest httpServletRequest,
                HttpServletResponse httpServletResponse) {
                ..........
                }

最佳答案

404 表示这是与资源命中有关的客户端错误。

如果添加问题时这不是拼写错误,请在操作及其值之间添加 =

<html>
<form action="action" method="post">
    <input type ="text" name="user.name"/>
    <input type ="text" name="user.pwd"/>
</form>
</html>

关于java - 客户端发送的请求在语法上错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20097377/

相关文章:

java - 简单控制台测试应用程序中的 NullPointerException

java - spring mvc 防止直接访问方法

java - Spring:访问 JSP 下拉列表中的模型属性列表

mysql - 为什么在 mysql 中键入数据 "long blob"在 Data Explorer MATLAB 中读取为 "int8"?

java - Centos 7 apache httpd无法加载weblogic插件库

java - 改变JTree第一个节点的图标

java - jdbc驱动程序错误

java.lang.AbstractMethodError : I get this exception when I am trying to initiate an outbound voice call using nexmo(vonage) API

java - 获取 java.lang.IllegalStateException : No thread-bound request found

java - NoClassDefFoundError : org/apache/poi/ss/formula/udf/UDFFinder error in java