I want to pass array elements from Java code into jsp page so that if I click the button it will show the array elements in the page.

I tried to use JSTL forEach tag inside JavaScript or jQuery but it doesn't work and I don't get any error when I run the program!

.jsp page joining jQuery and JSTL

```
<%@ taglib prefix="stripes" uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>

<stripes:submit name="showData" value="Show" id="button"></stripes:submit>

<script>
    $(document).ready(function() {
        $("button").button().click(function(){
            <c:forEach var="array" items="${actionBean.myArray }">
                <c:out value="${array }"></c:out>
            </c:forEach>
        });
    });
</script>

```

.jsp page joingin JS and JSTL

```
<stripes:submit name="showData" value="Show" onClick="myFunc"></stripes:submit>

<c:set var="newVar">
    <c:forEach var="array" items="${actionBean.myArray }">
        <c:out value="${array }"></c:out>
    </c:forEach>
</c:set>

<script type="text/javascript">
    var my_js_data = <c:out value="${newVar}"/>
    function myFunc() {
        return my_js_data;
    }
</script>

```