刚学习很懵  不知道还有springmvc 自己的表单  于是乎就上网查了一下  这个真的好用多啦

刚学习很懵  不知道还有springmvc 自己的表单  于是乎就上网查了一下  这个真的好用多啦

刚学习很懵  不知道还有springmvc 自己的表单  于是乎就上网查了一下  这个真的好用多啦

详细信息 springmvc  表单大全哟@

https://www.yiibai.com/spring_mvc/

1.    form标签
使用Spring的form标签主要有两个作用,第一是它会自动的绑定来自Model中的一个属性值到当前form对应的实体对象,默认是command属性,这样我们就可以在form表单体里面方便的使用该对象的属性了;第二是它支持我们在提交表单的时候使用除GET和POST之外的其他方法进行提交,包括DELETE和PUT等。
1.1  支持绑定表单对象
我们先来看如下使用form标签的一个示例:
  1. <form:form action="formTag/form.do" method="post">
  2. <table>
  3. <tr>
  4. <td>Name:</td><td><form:input path="name"/></td>
  5. </tr>
  6. <tr>
  7. <td>Age:</td><td><form:input path="age"/></td>
  8. </tr>
  9. <tr>
  10. <td colspan="2"><input type="submit" value="提交"/></td>
  11. </tr>
  12. </table>
  13. </form:form>
这个时候如果Model中存在一个属性名称为command的javaBean,而且该javaBean拥有属性name和age的时候,在渲染上面的代码时就会取command的对应属性值赋给对应标签的值。如在上面的代码中,假设Model中存在一个属性名称为command的javaBean,且它的name和age属性分别为“Zhangsan”和“36”时,那么它在渲染时就会生成如下一段代码:
input :一般的表单
  1. <form id="command" action="formTag/form.do" method="post">
  2. <table>
  3. <tr>
  4. <td>Name:</td><td><input id="name" name="name" type="text" value="ZhangSan"/></td>
  5. </tr>
  6. <tr>
  7. <td>Age:</td><td><input id="age" name="age" type="text" value="36"/></td>
  8. </tr>
  9. <tr>
  10. <td colspan="2"><input type="submit" value="提交"/></td>
  11. </tr>
  12. </table>
  13. </form>
  从上面生成的代码中,我们可以看出,当没有指定form标签的id时它会自动获取该form标签绑定的Model中对应属性名称作为id,而对于input标签在没有指定id的情况下它会自动获取path指定的属性作为id和name。
 
代码中的应用主要就是springmvc 的表单
 <body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/academic/expert/">专家学者列表</a></li>
<li class="active"><a href="${ctx}/academic/expert/form?id=${expert.id}">专家学者<shiro:hasPermission name="academic:expert:edit">${not empty expert.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="academic:expert:edit">查看</shiro:lacksPermission></a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="expert" action="${ctx}/academic/expert/save" method="post" class="form-horizontal">
<form:hidden path="id"/>
<sys:message content="${message}"/>
<div class="control-group">
<label class="control-label">姓名:</label>
<div class="controls">
<form:input path="fullName" htmlEscape="false" maxlength="255" class="input-xlarge required"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">姓名首字母:</label>
<div class="controls">
<form:select path="initialName" class="input-small ">
<form:option value="" label=""/>
<form:option value="A" label="A" />
<form:option value="B" label="B" />
<form:option value="C" label="C" />
<form:option value="D" label="D" />
<form:option value="E" label="E" />
<form:option value="F" label="F" />
<form:option value="G" label="G" />
<form:option value="H" label="H" />
<form:option value="I" label="I" />
<form:option value="J" label="J" />
<form:option value="K" label="K" />
<form:option value="L" label="L" />
<form:option value="M" label="M" />
<form:option value="N" label="N" />
<form:option value="O" label="O" />
<form:option value="P" label="P" />
<form:option value="Q" label="Q" />
<form:option value="R" label="R" />
<form:option value="S" label="S" />
<form:option value="T" label="T" />
<form:option value="U" label="U" />
<form:option value="V" label="V" />
<form:option value="W" label="W" />
<form:option value="X" label="X" />
<form:option value="Y" label="Y" />
<form:option value="Z" label="Z" />
</form:select> <span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">头像:</label>
<div class="controls">
<form:hidden id="nameImage" path="photo" htmlEscape="false" maxlength="255" class="input-xlarge"/>
<sys:ckfinder input="nameImage" type="images" uploadPath="/academic/expert" selectMultiple="false" maxWidth="100" maxHeight="100"/>
</div>
</div>
<div class="control-group">
<label class="control-label">国家:</label>
<div class="controls">
<form:select path="country" class="input-xlarge required">
<form:option value="" label=""/>
<form:options items="${fns:getDictList('country')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
</form:select>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">是否在首页显示:</label>
<div class="controls">
<form:radiobuttons path="isShowHomepage" items="${fns:getDictList('yes_no')}" itemLabel="label" itemValue="value" htmlEscape="false" class="required"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">工作单位:</label>
<div class="controls">
<form:input path="orgName" htmlEscape="false" maxlength="255" class="input-xlarge "/>
</div>
</div>
<%--<div class="control-group">
<label class="control-label">所属研究机构:</label>
<div class="controls">
<c:if test="${not empty expert.id }">
${expert.studyBranch}
</c:if>
</div>
</div>--%>
<div class="control-group">
<label class="control-label">职称职务:</label>
<div class="controls">
<form:input path="position" htmlEscape="false" maxlength="255" class="input-xlarge "/>
</div>
</div>
<div class="control-group">
<label class="control-label">个人简介:</label>
<div class="controls">
<form:textarea path="info" htmlEscape="false" rows="4" maxlength="5000" class="input-xxlarge "/>
</div>
</div>
<div class="control-group">
<label class="control-label">研究领域:</label>
<div class="controls">
<form:textarea path="research" htmlEscape="false" rows="4" maxlength="500" class="input-xxlarge "/>
</div>
</div>
<div class="control-group">
<label class="control-label">研究成果:</label>
<div class="controls">
<form:textarea id="majorWorks" htmlEscape="false" path="majorWorks" rows="4" class="input-xxlarge"/>
<sys:ckeditor replace="majorWorks" uploadPath="/academic/expert" />
</div>
</div>
<%--<div class="control-group">--%>
<%--<label class="control-label">论文:</label>--%>
<%--<div class="controls">--%>
<%--<form:textarea id="paper" htmlEscape="false" path="paper" rows="4" class="input-xxlarge"/>--%>
<%--<sys:ckeditor replace="paper" uploadPath="/academic/expert" />--%>
<%--</div>--%>
<%--</div>--%> <div class="control-group">
<label class="control-label">备注信息:</label>
<div class="controls">
<form:textarea path="remarks" htmlEscape="false" rows="4" maxlength="255" class="input-xxlarge "/>
</div>
</div>
<div class="form-actions">
<shiro:hasPermission name="academic:expert:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>&nbsp;</shiro:hasPermission>
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
</div>
</form:form>
</body>

哈哈哈哈 好喜欢 哟 欢迎吐槽

SpringMVC from 表单标签和 input 表单标签的更多相关文章

  1. button标签与input type=button标签使用的差异

    button标签和input type=button标签都是html文档中用来表示按钮属性的元素,不过他们在布局和实际使用功能中存在一些差异. 下面将项目中遇到的一些总结如下: 1.属性和布局差异. ...

  2. [转]SpringMVC<from:form>表单标签和<input>表单标签简介

    原文地址:https://blog.csdn.net/hp_yangpeng/article/details/51906654 在使用SpringMVC的时候我们可以使用Spring封装的一系列表单标 ...

  3. H5 基本标签使用 浅析 (含video标签、input表单等)

    1. 音频标签<audio> <audio src = “./music/Alone.mp3” controls autoplay loop = “3” ></audio ...

  4. <button>标签与<input type="button">标签

    <script type="text/javascript" src="/jquery-1.11.3.min.js"></script> ...

  5. SpringMVC学习系列(11) 之 表单标签

    本篇我们来学习Spring MVC表单标签的使用,借助于Spring MVC提供的表单标签可以让我们在视图上展示WebModel中的数据更加轻松. 一.首先我们先做一个简单了例子来对Spring MV ...

  6. 表单相关标签之input标签

    用于搜集用户信息. <input type="text" name="fname" /> 标签属性 type 规定 input 元素的类型.输入字段 ...

  7. 阻止form元素内的input标签回车提交表单

    <form></form>标签内input元素回车会默认提交表单. 阻止回车默认提交表单: $('form').on('keydown', function (event) { ...

  8. 前端与后台可能需要使用交互的表单form,input标签

    前端与后台可能需要使用交互的表单标签 form表单和input标签 textarea文本域表单 select,option下拉列表表单 fieldset和legend组合表单 label标签 form ...

  9. 表单提交按钮input和button、a的差异

    现在普遍的在网页中,表单提交数据的按钮最常见实用有三种,一种是input,一种是button,最后一种,是其他如a标签,div标签,span标签代替而来.在以前的日子里,大家都习惯于用input,因为 ...

随机推荐

  1. composer update的错误使用以及如何更新composer.lock文件

    用composer update装包是错误的. 安装包标准的方法应该是 require ,或者手动写 compose.json 文件,然后 composer install .如果只是需要更新 com ...

  2. delphi VCL组件同名继承

    当我们在扩展一个 vcl 组件功能的时候,既想保留IDE中能拖动大小与直接设置属性的功能,又想减少写创建与释放代码和安装扩展后新组件的麻烦,那么本文中的方法,就非常实用了. 以给TStringGrid ...

  3. taskkill /f /t /im processName

    /*@echo off */taskkill /f /t /im WINWORD.exetaskkill /f /t /im nginx.exetaskkill /f /t /im w3wp.exet ...

  4. ActiveMQ (一) 介绍与安装

    ActiveMQ是消息中间件的一种 ActiveMQ 是Apache出品,最流行的,能力强劲的开源消息总线.ActiveMQ 是一个完全支持JMS1.1和J2EE 1.4规范的 JMS Provide ...

  5. cf688B-Lovely Palindromes

    http://codeforces.com/problemset/problem/688/B B. Lovely Palindromes time limit per test 1 second me ...

  6. [luogu3379]最近公共祖先(树上倍增求LCA)

    题意:求最近公共祖先. 解题关键:三种方法,1.st表 2.倍增法 3.tarjan 此次使用倍增模板(最好采用第一种,第二种纯粹是习惯) #include<cstdio> #includ ...

  7. 杭电acm 1015题

    马上要找工作了,锻炼下自己的写程序能力,不多说,上代码 /********************杭电acm 1015 已AC 在这个程序里,使用穷举法来实现,但是输出顺序需要安装字典的最大 来输出 ...

  8. ZBar开发详解

    博客转载自:https://blog.csdn.net/skillcollege/article/details/38855023 什么是ZBar? ZBar是一个开源库,用于扫描.读取二维码和条形码 ...

  9. 85D Sum of Medians

    传送门 题目 In one well-known algorithm of finding the k-th order statistics we should divide all element ...

  10. python sort、sorted、reverse、reverd的区别

    sort.sorted.reverse.reversed的区别 !!! error 首先应该区分的是,sort和reverse是列表的一个方法.字符串.元组.字典.集合是没有这两个方法的.而sorte ...