Question Details

Browse

XML/XSL approach better than JSP?

By mahive - May. 28, 2008

Would like to know what some of the advantages are with the XML/XSL approach over JSPs.

Thanks!


Answers

Add Answer
  1. By an anonymous user on May. 28, 2008

    Here are some important differences:


    1) JSP decided to leverage existing languages, like Java and JavaScript. So

    the number of extra tags is small. XSLT decided to create yet another

    programming language. So it adds a number of new tags and significant

    complexity to the pattern language. Also, XSLT has lost the orthogonality

    between the pattern language ('XQL') and the transformation langue

    (xsl:template, etc.)


    2) JSP creates dynamic content; it loves side effects. It has direct access

    to the servlet API, to the Java library, including beans and JDBC. The entire

    point is to process forms and interact with databases. XSLT is essentially

    static, side-effect free. Oren's cool n-queens solution always produces the

    same result. It's cool from an implementation perspective, but it's

    indistinguishable from a static page when a browser looks at it.


    3) JSP produces a character stream. XSLT products XML. With JSP, there is no

    'entity reference problem'. You can produce HTML, TeX, PostScript, etc

    without jumping through hoops. On the other hand, if you want XML/DOM output

    (as you do on the client side), you need to parse the output.


    4) JSP jumbles content and style. XSLT cleanly separates them. So if you

    redesign your site, you've got to change all the JSP pages. With XSLT, you

    can change the stylesheet, and *presto* your site has a new look.


    The advantage of XSLT for a web site is that a non-technical writer can easily

    publish XML pages; the stylesheet does all the technical work. Take the

    example of a sports club, a weblog, or an alumni web site. The correspondant

    can just create simple XML. The XSL and the programming gurus can take care

    of the formatting and navigation.


    0 Votes
  2. By clarkr on May. 29, 2008

    @anon - great response!


    I guess it really comes down to what you mean by 'better'. JSPs, when used in the MVC paradigm as the Views, can really be used to do a lot of logic in the view (and abused at times too!), and that can be quite powerful, depending on what you wish to accomplish. XML/XSLT, on the other hand is great for request-response type transactions.


    0 Votes
  3. By mahive on May. 30, 2008

    Thanks - this is good input. we have a standard j2ee/struts + php application running on oracle that is used by different departments. we're now looking to deploy this as a "service" in a widgetized experience embedded on other applications. We were deciding between leaving it as is or eliminating the JSPs and moving to the XML+XSLT solution. any other input would be great. Will provide more details as well...


    0 Votes
Share your knowledge

Related Questions

Browse Get answers and share your expertise.