i am working in Spring MVC. i have no idea to use javascript variable in jstl tag. my function,
function funcAlert(){
var alert1 = document.querySelector('input[name = "deliverystatus"]:checked').value;
alert(alert1);
}
for the jstl tag,
<c:url var="selectDeliveryman" value="/admin/order/selectDeliveryman?id=${orderAttribute.orderId}&deliveryname=" />
i want to use variable alert1 in the end of deliveryname= anyone please help me, alot of thanks
您可以简单地用作${alert1}
,但是您需要在脚本中全局声明它,并确保alert1
作为服务器端运行,因此您只能获取alert1
值,该值在页面加载期间初始化,然后您对该变量,您无法在jstl中获得它。
<c:url var="selectDeliveryman" value="/admin/order/selectDeliveryman?id=${orderAttribute.orderId}&deliveryname=" />
<script>
function submit() {
var alert1 = document.querySelector('input[name = "deliverystatus"]:checked').value;
document.location="${selectDeliveryman}"+alert1;
}
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.