Hi all,
I am interested in using XSL for UI purposes of web pages. I am reading a
bit about it, and have a decent understanding of its purpose, but I am
wondering if anyone doing this can give me a little insight into the
process.
Currently, we are using a MVC framework: single controller servlet, one or
more action classes, jsp pages, javabeans, etc. Some JSP pages use looping
constructs to display a list of items. All have some sort of HTML in them.
So, I ask..is what I am about to list the "right" way of moving away from
MVC forwarding to JSP pages, but instead using JSP to return XML that is
then applied with an XSL file to convert to HTML then return that HTML the
right way.
1) request goes to action class (through the controller servlet)
2) action class calls back-end logic (ejb) which populates a javabean with
results.
3) JSP page is read in via URLConnection (or something similar) which
returns XML content (not HTML).
4) The JSP page doesn't include any HTML, but instead XML tags and uses the
javabean to insert the data that fits in those tags
5) XALAN is then somehow called with the resulting XML (probably in a String
or StringBuffer), a XSL file path/name is also passed in, and either it
returns
a String (or StringBuffer) of the transformed HTML, or you pass in a
StringBuffer that then gets populated with the transformed HTML.
6) Place the HTML output from XALN in the response buffer.
7) return the response.
In this manner, if this is correct, each and every request would require the
use of a URLConnection, reading in the xml output from the JSP page that is
build dynamically via the javabean results the JSP page makes use of. It
then gets transformed into HTML by XALAN using an XSL of some sort, and the
result..instead of RequestDispather forwarding or response.sendRedirect() to
a JSP page, gets put in the respone buffer (much like doing HTML the old way
in servlets) and that goes back.
Is this the way its done? Or is there some other way? I am sure there are
lots of ways, but I am hoping to use the most common approach that
developers are using today.
I have a bit to learn, but in general..is it common to use XSL in place of
JSP for HTML output if you are going to go this route? Should I rework all
my JSP pages into returning XML, remove HTML out of them, put XML tags in
them and only data in those tags (from the javabean for that page that the
controller/action populates via the logic), then apply XSL to "format" the
data of the XML? My original knowledge led me to believe I leave my JSP
pages as they are and apply formatting via XSL..but I don't think that can
work.
Lastly, I would like to look into the use of XSL for producing PDF, RTF, and
WML. WML would be for wireless devices. PDF can be converted to PostScript
by our faxing solution, and RTF can be displayed with better than HTML
formatting (as could PDF) on screen, ofcourse requiring an RTF plugin to a
browser (which MSIE doesn't require for Windows platforms). We are using a
hokey document producing factory, where by we require two classes (on for
reading and one for writing the xml) as well as a new class to "lay out" the
output of the document. I would think this could be abolished by simply
creating an XSL that produces the RTF out of the data from the xml. Is this
so?
Thank you very much.
===========================================================================
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://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets