Spring jsp 下拉列表
完整代码
<%--
Created by IntelliJ IDEA.
User: wsh
Date: 2019/7/21
Time: 11:35
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<html>
<head>
<title>Title</title>
</head>
<body>
<h2>Hello Spring boot jsp</h2>
<form:form modelAttribute="user" action="save" method="post" >
用户名:<form:input path="username"></form:input>
<form:errors path="username" /> <br>
密码: <form:password path="password"></form:password><br>
性别: <form:radiobutton path="xb" value="男"/>男
<form:radiobutton path="xb" value="女"/>女<br>
技能: <form:checkboxes path="jineng" items="${jinengItme}" /><br>
故乡: <form:select path="guxiang" >
<form:option value="">选择值</form:option>
<form:options items="${guxiang}" />
</form:select><br>
<button type="submit">提交</button>
</form:form>
</body>
</html>
1.jsp代码
故乡: <form:select path="guxiang" >
<form:option value="">选择值</form:option>
<form:options items="${guxiang}" />
</form:select><br>
2.1Spring 数据代码
private Map<String,String> getGuxiang(){
Map<String,String> map = new HashMap<>();
map.put("chenzhou","郴州");
map.put("guiyang","桂阳");
map.put("leiyang","耒阳");
map.put("changsha","长沙");
return map;
}
2.2Spring 模型代码
@GetMapping("/")
public String getIndexPage(Model model){
model.addAttribute("guxiang",getGuxiang());
return "hello";
}
Spring jsp 下拉列表的更多相关文章
- 普通spring jsp+mybatis项目修改为springboot + jsp +mybatis项目
概述 由于公司决定使用spring cloud,但是公司积累了大量的普通的jsp项目,老的项目直接全部修改为springboot成本过高,周期比较长,而且公司业务正在快速拓展,所以需要把之前的老项目修 ...
- Spring jsp 验证 form:errors标签
1 在model层添加验证规则 @NotNull @Size(min=2,max =30,message="姓名在2-30个字符之间") private String userna ...
- jsp下拉列表
<c:set var="REPORT_TYPE_NORMAL" value="<%=SysIndexFormTemp.REPORT_TYPE_NORMAL%& ...
- Spring MVC学习
SpringMVC框架 转载请注明出处 目录 一:配置springMVC开发环境 1.1.配置文件的helloworld 1.2.基于注解的helloworld 二:@RequestMapping详解 ...
- 基于Spring MVC的Web应用开发(三) - Resources
基于Spring MVC的Web应用开发(3) - Resources 上一篇介绍了在基于Spring MVC的Web项目中加入日志,本文介绍Spring MVC如何处理资源文件. 注意到本项目的we ...
- mybatis+spring+struts2框架整合
近期公司要开发新的项目,要用struts2+mybatis+spring框架,所以学习了下,来自己的博客发表下,希望能给大家带来帮助!下边我把我的myschool开发的源代码以及数据库贴出来! 开 ...
- 超轻量级spring模板方案
最近从事的工作是web方面的,主要j2ee,spring jsp这些内容,由于刚入门,很多的技术都不了解.所谓初生牛犊不怕虎,刚入门,各种不顺手,比如写jsp,总是重复很多的代码,各种不爽,然后就去看 ...
- Spring 5 (0) - Introduction & Index
Spring Framework Reference Documentation I. Overview of Spring Framework . Getting Started with Spri ...
- Spring官方文档翻译
随笔:有人曾这样评价spring,说它是Java语言的一个巅峰之作,称呼它为Java之美,今天,小编就领大家一起来领略一下spring之美! Spring官方文档:http://docs.spring ...
随机推荐
- Greenplum 查看表的分区键与分区类型
方法一 查看表的分区键 select d.nspname||'.'||a.relname as table_name,string_agg(b.attname,',') as column_namef ...
- java+web+下载断点续传
1.先将 webuploader-0.1.5.zip 这个文件下载下来:https://github.com/fex-team/webuploader/releases 根据个人的需求放置自己需要的 ...
- 主席树K-th Number
/*K-th NumberTime Limit: 20000MS Memory Limit: 65536KTotal Submissions: 44535 Accepted: 14779Case Ti ...
- Codeforces 221d D. Little Elephant and Array
二次联通门 : Codeforces 221d D. Little Elephant and Array /* Codeforces 221d D. Little Elephant and Array ...
- UOJ 449 【集训队作业2018】喂鸽子 【生成函数,min-max容斥】
这是第100篇博客,所以肯定是要水过去的. 首先看到这种形式的东西首先min-max容斥一波,设\(f_{c,s}\)表示在\(c\)只咕咕中,经过\(s\)秒之后并没有喂饱任何一只的概率. \[ \ ...
- Codeforces 704E Iron Man [树链剖分,计算几何]
Codeforces 这题--真是搞死我了-- 好不容易下定了决心要不颓废,要写题,结果一调就调了十几个小时-- 思路 我们发现在树上做非常不舒服,于是树链剖分之后一次在重链上的移动就可以看做是在df ...
- 使用u盘安装linux(manjaro)时Grub报错
本文通过MetaWeblog自动发布,原文及更新链接:https://extendswind.top/posts/technical/manjaro_install_problem_grub 错误 e ...
- zookpeer 和 redis 集群内一致性协议 及 选举 对比
zookeeper 使用的是zab协议,类似 raft 的 Strong Leader 模式 redis 的哨兵 在 崩溃选举的时候采用的是 raft的那一套term. 因为redis 采用的是异步 ...
- 使用vscode快速建立vue模板
当我们希望每次新建.vue文件后,vscode能够根据配置,自动生成我们想要的内容. 打开vscode编辑器,依次选择“文件 -> 首选项 -> 用户代码片段”,此时,会弹出一个搜索框,我 ...
- insomnihack CTF 2016-microwave
目录 程序基本信息 程序漏洞 整体思路 exp脚本 内容参考 程序基本信息 程序防护全开,shellcode修改got表等方法都不太可行,同时pie开启也使程序代码随机化了. 程序漏洞 这是一个发推特 ...