www.webdeveloper.com
Results 1 to 3 of 3

Thread: Java Script Menu with XML menu entries.

  1. #1
    Join Date
    Jul 2008
    Posts
    2

    Exclamation Java Script Menu with XML menu entries.

    Hi All,

    I am thinking, it would be best to generate the complete Javascript Code for the navigation menu within a Java-Class and call this functionality out of the JSP page.

    To make it easier to maintain the menu-structure and all the therefore needed information, we had the idea to store this information in an XML file.

    Of course this would be a higher effort at the beginning, but it would also have the advantage that, once a working js-menu can be generated out of the Java-Class, no one would ever have to adjust coding and/or settings directly in the Javascript. New menu entries then simply have to be added to this XML file.

    Can you please help me how to go about with this requirement?

    Thanks and Rgds,
    Pradeep

  2. #2
    Join Date
    Oct 2007
    Location
    USA
    Posts
    73
    Although I'm not much of a JSP expert, I can tell off the bat that you'll have at least two options:

    • Server-side incorporation of XML at request time
    • Client-side AJAX calls


    But I wouldn't use anything client-side, as they'll involve your web server in multiple requests per page.

    Your idea is a good one, though, as a navigation menu is reusable code, and an XML representation of it is a good application of the technology. Plus, like you mentioned, you only need to change it once. I would suggest spending some time coming up with a good data model for this XML navigation menu. It'll pay off in the future.

    Implementation can be achieved in many different ways. You could send the XML nav menu as part of an entire XML document to be transformed later (by an XSLT) or have JSP use whatever DOM class it uses to load the XML after the browser request, parse it, and rearrange it as HTML for the server response. You might even be able to apply XSLT's on the server (like in .NET).

    This XML nav menu is a great idea I think for anyone out there looking for something to DO with XML.

  3. #3
    Join Date
    Jul 2008
    Posts
    2
    Hi All,

    Any suggestions/ code samples to help me out? I really stuck without more ideaS!

    Rgds,
    Kino

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles