如何从百万富翁的控制器获取twitter bootstrap进度条中的数据?我是Spring-mvc和thymeleaf的新手

时间:2015-11-05 12:58:05

标签: twitter-bootstrap spring-mvc thymeleaf

我想从我的控制器中添加数据,以显示百里香的进度条。我尝试了不同的方法但没有工作。

<div class="progress progress-striped">
    <div class="progress-bar progress-bar-warning" role="progressbar" **th:aria-valuenow="${model}"** aria-valuemin="0" aria-valuemax="100" **th:style="@{'width:'+ ${percent} +';'}"**>
         <span class="sr-only">30% Complete (warning)</span>
     </div>

2 个答案:

答案 0 :(得分:3)

I tried using your answer and it didn't worked for me, but it helped to find an answer for me:

<div class="progress active">
    <div class="progress-bar progress-bar-success progress-bar-striped" role="progressbar"  aria-valuemin="0" aria-valuemax="100" th:attr="aria-valuenow=${p.value}" th:style="'width:'+ ${p.percent}+'%;'"></div>
</div>

p.value and p.percent are model attributes that I send from my controller. Both have numeric values.

答案 1 :(得分:1)

找到它:

<div class="progress progress-striped">
<div class="progress-bar progress-bar-warning" role="progressbar" **th:aria-valuenow="${model}"** aria-valuemin="0" aria-valuemax="100" th:attr="aria-valuenow=${model}" th:style="'width:'+ ${percent}+';'}">
     <span class="sr-only">30% Complete (warning)</span>
 </div>