Hi all,

        I have a site that needs to use alot of JavaScript. The JavaScript
is dynamically created using values from the server side. I have it
implemented 2 ways:

        1) In a JSP page: I use struts logic and bean tags to help me create
my JavaScript.
        -This approach I like cause it keeps it clean and easy to
understand.
        -I dont like this approach because it takes a big hit to create the
javascript everytime that you access that page. (ALOT of data)
        2) In my servlet. I create the necessary JavaScript files in the
init() method.
        -I like this approach because the javascript is created once so you
dont take that big performance hit.
        -I dont like this approach because I want to keep the presentation
logic (which I consider the javascript to be a part of) separate from the
business logic. Also this approach is quite messy as you can imagine with
StringBuffers appending escaping "s and what not.

        Is there a way to cache up the response from a JSP page so that i
can reuse it over and over again in some String variable? I know that this
can be done using the URLConnection but that approach seems strange because
ur making a URLConnection from the serverside to a page in ur own
webapplication! :P There MUST be a better way.

Thanks!
-Tim

PS. on the subject. I've also used XML with XSL to build javascript in JSPs
(using XTags taglib from jakarta). Is this any faster than my first
approach? Unfortunately, for phase I of my proj, I dont have the option of
getting my data in XML format (although I use it for my page navigations and
such). But this will be nice to know so that I can decide if it is worth
pursuing for future phases.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to