我正在編寫一個java spring mvc web應用程序,並且在客戶端,我使用bootstrap和星級評分插件來顯示我正在顯示的歌曲列表用戶。Spring MVC獲取onclick輸入星級評分值
我正在做的是傳遞我在會話中生成的播放列表,並在jsp中迭代此列表以創建適合正確的表。在歌曲名稱\標題的旁邊,我想顯示星級評分系統;我做到了,但它被設置爲輸入數字。我想要做的是,在星星點擊後,重定向到另一個頁面,在控制器中檢索速率,製作一些邏輯,然後返回沒有該歌曲的播放列表頁面。
我有一些困難,因爲在控制器上,爲了理解哪首歌得到了評價,我顯然必須將歌曲的id作爲輸入參數,所以輸入的名稱就像「input2838 「,但在控制器端,當我必須請求參數RequestParameter
值時,我需要指定我想要的參數名稱,所以我認爲這不是正確的做法。
請問您對如何做這種東西的建議,而且,最重要的是,如何重定向到另一個頁面,傳遞參數的值,當我點擊輸入...
我向您展示jsp代碼片段,其中顯示了歌曲表。
<script>$("#input-id").rating();</script> <-- initialize the stars script
<c:choose> <-- when the playlist is not empty show it
<c:when test="${not empty playlist}">
<div class="container col-lg-10 col-lg-offset-1" >
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th>#</th>
<th>Cover</th>
<th>Artista</th>
<th>Titolo</th>
<th>Rate</th>
</tr>
</thead>
<tbody>
<c:forEach items="${playlist}" var="canzone" varStatus="count">
<tr style="font-weight: normal">
<td style="font-weight: normal">${count.index +1}</td>
<td style="font-weight: normal"><img src="${canzone.albumImageUrl}" /></td>
<td style="font-weight: normal">${canzone.artistName}</td>
<td class="col-lg-4" style="font-weight: normal">${canzone.title}</td>
<td class="col-lg-4" style="font-weight: normal"><div><input id="input-id" type="number" class="rating" min=0 max=5 step=1 data-size="xs" data-rtl="false"></div></td>
<tr>
</c:forEach>
</tbody>
</table>
</div>
</c:when>
<c:otherwise>
現在我發佈你的完整性星級JS作爲引擎收錄鏈接的緣故:
不要猶豫,問其他的相關信息。
很遺憾一個表格不能插入tr標籤內... – lateralus 2015-02-06 10:30:00
然後把表格放在
它以某種方式告訴我它不能看到結束標記... http://pastebin.com/VF42RDbA – lateralus 2015-02-06 11:00:18
相關問題