Announcement Announcement Module
Collapse
No announcement yet.
JSTL & javaScript Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JSTL & javaScript

    Hi

    i tri to send a ArrayList to javascript

    in the jsp i use <c:forEach var="x" items="${stuff.arr}">....

    but I want to use ${stuff.arr} to assign a var in js

    like var arr = ${stuff.arr}


    any ideas?

    tnx

  • #2
    What you do in JSTL happens on the server-side, whereas JavaScript is executed on the client-side. Furthermore, if you access objects in JSTL, they are usually located inside the HTTP request, which isn't accessible any more once the page is displayed on the client.
    Your best bet would be print out all the array's values with JSTL inside the source of a JavaScript method, that initializes the array you want to use there.

    HTH
    Last edited by F.Degenaar; Jun 2nd, 2010, 04:34 AM.

    Comment


    • #3
      i see

      Originally posted by F.Degenaar View Post
      What you do in JSTL happens on the server-side, whereas JavaScript is executed on the client-side. Furthermore, if you access objects in JSTL, they are usually located inside the HTTP request, which isn't accessible any more once the page is displayed on the client.
      Your best bet would be print out all the array's values with JSTL inside the source of JavaScript method, that initializes the array you want to use there.

      HTH

      i got it

      tnx

      Comment

      Working...
      X