javaee springMVC绑定复杂对象

jsp

html 复制代码
<%--
  Created by IntelliJ IDEA.
  User: HIAPAD
  Date: 2019/11/29
  Time: 14:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>

<form action="users/addUser" method="post">

    <pre>
    用户名:<input type="text" name="uname" />
    密码:<input type="password" name="pwd" />
    地址:<input type="text" name="address.detail" />
    <input type="submit" name="sub" value="提交" />

    </pre>
</form>


</body>
</html>

java

java 复制代码
package com.test.controller;

import com.test.pojo.Users;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("/users")
public class UsersController {

    @RequestMapping("/addUser")
    public String addUser(Users user)
    {
         System.out.println(user);

         return "success";
    }
}
相关推荐
钱栈up5 分钟前
VSCode 调试多模块 Maven + Spring Boot 后端:从启动失败到一次跑通
java·spring boot·maven
uoKent6 分钟前
c++中new和malloc的区别
java·jvm·c++
十五喵源码网17 分钟前
基于springboot2+vue2的疾病防控综合系统
java·毕业设计·springboot·论文笔记
砚底藏山河23 分钟前
【量化纯GET实战 #11】移动均线 MA:5 日 20 日 60 日怎么算怎么用
java·python·金融·maven
一只小闪闪35 分钟前
easy-trans java数据通用翻译框架v2.3.0
java·后端·架构
2601_9620558137 分钟前
Spring全部注解
java·后端·spring
chjif1 小时前
一张照片和一段声音如何生成口播视频:MiniMax H3 音画同步实测
java·前端·javascript
何以解忧,唯有..1 小时前
LangChain 中 Pydantic 格式输出:结构化输出的完整指南
java·开发语言·langchain
旧梦95271 小时前
Java 捕获多个异常:从基础语法到最佳实践
java·开发语言
2601_962189601 小时前
【SpringBoot】使用IDEA创建SpringBoot项目
java·spring boot·intellij-idea