Announcement Announcement Module
Collapse
No announcement yet.
Adding Javascript to .jspx file in Roo Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding Javascript to .jspx file in Roo

    Hello,

    I need to add Javascript contained in an external file that uses JSON, to the show.jspx file in one of my Spring Roo Projects.

    I have added the following html to the top of my jspx file, but, unfortunately, it does not work

    <script type="text/javascript" src="/myapp/resources/js/outsidejavascript.js" />

    because when I call one of the vars in that file

    var piHost = (function () { ..

    as follows

    dojo.addOnLoad(function() {
    alert(piHost);
    });

    no alert message gets displayed.

    [Note: I used the dojo addOnLoad function above because it would seem as though Dojo, which is the default JavaScript library in Roo, won't let you use functions coming from outside scripts, unless you add them or register them (but I may be wrong).]

    Do I need to somehow register the variables and functions in the outsidejavascript.js file, perhaps with "dojo.require" or some other Dojo function?

    Furthermore, the developer who wrote the outsidejavascript.js file, told me to include json2.js in my html page, so as to be able to use his functions. I don't know json as I am an old-style Javascript programmer.
    Do I need to include json2.js or does Dojo automatically include the Json2 functions?

    Many thanks.

    Philroc

  • #2
    I am very interested to know whether you did find a solution to the problem described above. If that is the case can you share it.
    If that is not the case can someone please provide a reply?
    Regards,
    Julien.

    Comment

    Working...
    X