Possible Duplicate:
How to set the JSTL variable value in javascript?
I have certain codes as following:
<c:set var="test" scope="page" value="0"/>
<script type="text/javascript">
var time;
function Check(){
if(time <= 0)
{
<c:set var="test" scope="page" value="1"/>
}
time-=1;
}
</script>
when I did
<c:out value="${test}"/>
it seems that its value's always 1 and it happened before time=0 or less than 0. And also did something below:
<c:if test="${test=='1'}">
<sql:transaction dataSource="${dataBase}">
<sql:update var="tDel">
DELETE FROM tmp_time WHERE username='${username}'
</sql:update>
</sql:transaction>
</c:if>
It always comes to DELETE at the first time and not wait till time=0 or less. Can anyone help me out?
time-=;is a syntax error, and given that you don't initialisetimewhen you then test it withif(time <= 0)that condition will always be false.