![](/img/trans.png)
[英]jstl <c:if> tags not working in jsp file, getting error in tomcat 7
[英]jstl c:set is not working on js code in jsp file
我有來自服務的JSON。 我要按JSON值附加html塊,並且必須檢查一些值以進行適當的顯示。 我正在嘗試設置DiscountValue變量,但不能與js變量一起使用。 我該如何解決?
if (data!="")
{
$.each(data,function(index,element){
var intDiscount=parseInt(10);
console.log("intDiscount::"+intDiscount);
var strIndex='';
strIndex+='<div class="card">';
strIndex+='<c:set var="discountValue" value="'+intDiscount+'"/>';
console.log("${discountValue}");
...
...
...
...
}
$('#visilabs-FavouriteCategoryTopSeller').append(strIndex);
控制台日志:
intDiscount::10
0
我已經通過使用if條件與js解決了它:
if(element.discount>0){
strIndex+= ' <span class="label label-danger discount">'+'% '+intDiscount+'</span>';
}
感謝大家
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.