1) <select onChange="showList(this.value);">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
2)<script type="text/javascript">
function showList(value){
var endValue=value;
}
</script>
what i want is I want to set the value of end is the selcted value of dropdown
3)<c:forEach begin="1" end="? Here I want to set the endValue">
<h1>print data<h1>
</c:forEach>
Best Solution
The
<c:forEach>
is a jstl tag that's evaluated on the server side, so you would need to reload the page for the user's input to affect the evaluation of that tag. You could do that with a form post when theselect
is changed, as in the example below. This could be done in different ways, but there's no way around the fact that you need to go back to the server.