Announcement Announcement Module
Collapse
No announcement yet.
passing a variable from action to jsp Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • passing a variable from action to jsp

    Hello everyone,
    First of all, thank you very much to all these that are trying to solve our problems in this forum
    I am developing a web application with struts2+spring3. And I have a question about how to pass a variable (an array of arrays) from the action class to the jsp page.
    I know that the only you need to do is to declare a private variable in my action and a get method for that variable and then its possible to access these variable from the jsp, I have done it and it works.
    Code:
    public class Workspace extends ActionSupport {
    
        private String[][] objects=null;
    
        public String[][] getObjects() {
            return objects;
        }
    
        public String execute() throws Exception{
    [...]
    The problem is that I want to access to this variable from the javascript code before loading the whole web page.
    I have tried by different ways but it is never working.
    Code:
    $(function() {
    	var objectsMap=new Array();
    
            $(document).ready(function() {
    	          objectsMap = $objects;
            });
    [...]
    Anyone have idea about how could I do that?
    Thank you very very much!
    Aleix
Working...
X