Skip to content

Instantly share code, notes, and snippets.

@yanhua365
Last active December 29, 2015 15:19
Show Gist options
  • Save yanhua365/7689753 to your computer and use it in GitHub Desktop.
Save yanhua365/7689753 to your computer and use it in GitHub Desktop.
Freemarker和Bootstrap结合高亮显示单个输入验证错误的消息
<#--
* 结合bootstrap的样式,有错误的时候高亮显示字段
* config是表单绑定的模型对象,targetVersion是它的一个属性
-->
<@spring.bind "config.targetVersion"/>
<#assign error>
<#if spring.status.errorMessages?has_content>error</#if>
</#assign>
<div class="control-group ${error}">
<label class="control-label" for="inputTargetVersion">升级后版本</label>
<div class="controls">
<@spring.formInput 'config.targetVersion' 'placeholder="要升级到的版本" class="span4"'/>
<#if error?has_content>
<span class="help-inline"><@spring.showErrors "","" /></span>
</#if>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment