Reputation: 284
I want to pass one textfield value in jstl fmt tag at onblur event. I am using below code but does not working.
js code:function setPercentage(id){
var idVal = $('#'+id).val();
alert('<fmt:formatNumber type="percent" maxIntegerDigits="3" value="${idVal}"/>');
}
html code:
<input type="text" id="myValue" onblur="setPercentage('myValue')"/>
onBlur I am getting nothing.. please help me..
Upvotes: 3
Views: 7337
Reputation: 284
I got one answer from chat.stackoverflow i.e. javascript is executed on the client side while jstl is server side. So it is not possible to passjavascript varaible in jstl fmt tag.
we can use any request or session value in jstl fmt tag within using EL.
js code:<script type="text/javascript">
function setPercentage(){
alert('<fmt:formatNumber type="percent" maxIntegerDigits="3" value="${idVal}"/>');
}
</script>
here idVal is request or session scoped value.
Upvotes: 3