springBoot学习笔记-14-添加员工


添加员工.

1、增加添加按钮.

<a class="btn btn-success btn-sm float-right" th:href="@{/emp}" >添加</a>

2、填写添加 页面 add.html.

这里直接拷贝 list.html , 替换 main标签下的内容

<main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
    <form th:action="@{/emp/add}" th:method="post">
        <div class="form-group">
            <label>LastName</label>
            <input name="lastName" type="text" class="form-control" placeholder="海绵宝宝">
        </div>
        <div class="form-group">
            <label>Email</label>
            <input name="email" type="email" class="form-control" placeholder="1176244270@qq.com">
        </div>
        <div class="form-group">
            <label>Gender</label><br>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" name="gender" value="1">
                <label class="form-check-label"></label>
            </div>
            <div class="form-check form-check-inline">
                <input class="form-check-input" type="radio" name="gender" value="0">
                <label class="form-check-label"></label>
            </div>
        </div>
        <div class="form-group">
            <label>department</label>
            <select name="department.id" class="form-control" >
                <option th:each="department:${departments}" th:text="${department.getDepartmentName()}" th:value="${department.getId()}"></option>
            </select>
        </div>
        <div class="form-group">
            <label>Birth</label>
            <input name="birth"  class="form-control" placeholder="">
        </div>
        <button type="submit" class="btn btn-primary">添加</button>
    </form>
</main>

3、填写 跳转方法 和 添加方法.

4、结果展示.


文章作者: liuminkai
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 liuminkai !
评论
 上一篇
springBoot学习笔记-16-整合JDBC springBoot学习笔记-16-整合JDBC
1、创建新项目. 2、编写 application.properties配置文件 – 数据库连接. 注意:serverTimezone 必须写,SpringBoot默认mysql8 ,mysql8需要配置时区 # 数据库连接 sprin
2020-09-29
下一篇 
springBoot学习笔记-15-修改和删除员工(含404) springBoot学习笔记-15-修改和删除员工(含404)
修改员工.1、修改list.html页面. 2、编写 edit.html页面. 替换 list.html中的main标签部分 <main role="main" class="col-md-9 ml-sm-auto col-lg-1
2020-09-29
  目录