0

I have a variable inside the javascript document.ready function:

<script type="text/javascript">
    $(document).ready(function() {
        var xxxx= $("#yyyy").val();
        alert(xxxx);
    });
</script>

I want to use the above xxxx variable in a JSP file. This is my JSP code which did not work:

<c:choose>   
    <c:when test="${xxxx == 'type'}">
        ........
    </c:when>
    <c:otherwise>
        .......
    </c:otherwise>
</c:choose>

Pleaase suggest me the method to use a javascript variable in a JSP file.

Hexaholic
  • 3,299
  • 7
  • 30
  • 39
Nirmal Anand
  • 307
  • 1
  • 4
  • 14
  • 3
    I think this may answer your question http://stackoverflow.com/questions/20390832/how-to-use-javascript-in-jsp – blairmeister May 21 '15 at 10:11
  • Server-side logic shouldn't work with client-side code, unless you are constructing a hacking challenge :) – Dropout May 21 '15 at 11:39

0 Answers0