I am using "JSTL" ans "struts2" in my project.I am trying set a value in the scope using JSTL and Struts2 tag as follows,
<div id="id1"></div>
<div id="id2"></div>
<%
int b=10;
%>
<c:set var="test2" value="<%= b %>"/>
<s:set var="test3" value=" <%=b%>" />
<script>
document.getElementById("id1").innerHTML="${test2}"; //10
document.getElementById("id2").innerHTML="${test3}"; //nothing is displayed.
</script>
The output is 10 only. My doubt is why the expression <%= b %>
works in <c:set>
tag
and not work in <s:set>
tag?