V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
q397064399
V2EX  ›  Java

Spring MVC 数据绑定的标签,是不是无法插入 html 属性

  •  
  •   q397064399 · 2016-09-16 08:57:31 +08:00 · 2223 次点击
    这是一个创建于 2784 天前的主题,其中的信息可能已经有所发展或是发生改变。
    <%@ taglib prefix="c" uri="http://www.springframework.org/tags/form" %>
    引用了 spring mvc


    <c:input path="username" class="form-control" placeholder="Username"/>
    这里引用了 c:input 标签,后面插入了一些属性
    解析成 html 客户端是这样的
    <input id="username" name="username" placeholder="Username" class="form-control" type="text" value=""/>

    但是插入了 required autofocus 之后 变成这样
    <c:input path="username" class="form-control" placeholder="Username" required autofocus />
    却无法解析了

    难道所有框架的标签都无法完全按 html 来书写?
    4 条回复    2016-09-19 21:09:34 +08:00
    q397064399
        1
    q397064399  
    OP
       2016-09-16 08:59:44 +08:00
    好吧,我知道了 后面的是 HTML5 属性, Spring 貌似不能解析
    q397064399
        2
    q397064399  
    OP
       2016-09-16 09:07:01 +08:00
    stackoverflow 大法好 autofocus="autofocus" 解决, Spring 真的太远古了
    zonghua
        3
    zonghua  
       2016-09-17 01:55:08 +08:00 via iPhone
    @q397064399 spring 也不建议使用 jsp 啦
    q397064399
        4
    q397064399  
    OP
       2016-09-19 21:09:34 +08:00
    @zonghua 那用什么做 VIEW 层?
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   817 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 22:30 · PVG 06:30 · LAX 15:30 · JFK 18:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.