q397064399
V2EX  ›  Java

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

  •  
  •   q397064399 · Sep 16, 2016 · 2762 views
    This topic created in 3587 days ago, the information mentioned may be changed or developed.
    <%@ 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 replies    2016-09-19 21:09:34 +08:00
    q397064399
        1
    q397064399  
    OP
       Sep 16, 2016
    好吧,我知道了 后面的是 HTML5 属性, Spring 貌似不能解析
    q397064399
        2
    q397064399  
    OP
       Sep 16, 2016
    stackoverflow 大法好 autofocus="autofocus" 解决, Spring 真的太远古了
    zonghua
        3
    zonghua  
       Sep 17, 2016 via iPhone
    @q397064399 spring 也不建议使用 jsp 啦
    q397064399
        4
    q397064399  
    OP
       Sep 19, 2016
    @zonghua 那用什么做 VIEW 层?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3303 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 10:57 · PVG 18:57 · LAX 03:57 · JFK 06:57
    ♥ Do have faith in what you're doing.