It's not a secret anymore!
The moose likes Struts and the fly likes populating javascript arrays from struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "populating javascript arrays from struts" Watch "populating javascript arrays from struts" New topic

populating javascript arrays from struts

BC claudio

Joined: May 02, 2005
Posts: 5
i need to populate arrays in javascript for use in client side interactivity.
ive seen the org.apache.struts.taglib.html.JavascriptValidatorTag but i dont know if its useful..

does anyone have an idea?
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
if you have your array values are coming from your action (as a collection, arraylist, map, etc.), iterate through the them using logic:iterate or c:forEach INSIDE the <script...> tag to construct the js arrays then proceed with the js business as usual.

-/a<br />certified slacker...yes, my last name is 'do' - <a href="" target="_blank" rel="nofollow"></a>
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The org.apache.struts.taglib.html.JavascriptValidatorTag would not be useful here. It's purpose is to render javascript created by the validator.

Consultant, Sima Solutions
I agree. Here's the link:
subject: populating javascript arrays from struts
It's not a secret anymore!