I think that your points here actually outline why it would be a benefit to use
both JSP and XSL. For example, an average JSP on our site (after we complete the
new architecture, design, and development), will first access a session bean that
will log the use of the page, check to see if they have a session bean, if not it
will initialize it, and  check their security (via a call to LDAP) to decided if
they should get the requested page or not. Then our JSP page will call Java methods
that will create XML objects. So a page that is going to show a specific report,
may have two or three methods that each return an XML object for that piece. The
JSP page will then use an XSL tag to render the HTML. It would look like below (I
don't have JSP 1.1 yet, so forgive any syntax errors please). This is very rough,
but please punch holes in the idea if you can. The main idea is that JSP is the
central place to call gather XML objects, wrap them in tag calls to specified XSL
(which will be dynamic depending on the user and their device, etc)., use bean
information and wrap it all together.


<%-- This sets the session bean, logs the page and checks the security (within the
bean), by
checking to see what security level they have --%>
<jsp:useBean beanName="vpSession" type="SessionBean" scope="session">
<jsp:setProperty name="vpSession" propety="PageAccessed" value="HomePage" />
<jsp:setProperty name="vpSession" propety="PageVersion" value="2.1" />
</jsp:useBean>

<%-- this accesses the Navigation bean, which creates the table around the report
(links to home page, etc) --%>
<jsp:useBean beanName="vpInterface" type="InterfaceBean" scope="page">
<jsp:setProperty name="vpInterface" propety="PageAccessed" value="HomePage" />
<jsp:setProperty name="vpInterface" propety="PageVersion" value="2.1" />
<%= vpInterface.getInterface() %>
</jsp:useBean>

<%-- this code comes from an email sent by Ryan Shriver. At present we use JSP .90,
so I can't test this --%>
<%-- this gets and displays the customer object --%>
<%@ taglib uri="taglib.tld" prefix="stl" %>
<stl:xslt xsl="customer.xsl" />
 <Customer Name="John doe">
  <Account ID="01" Balance="1230$">
  <Account ID="02" Balance="-50$">
 </Customer>
</stl:xslt>

<%-- this is another XML object that will be displayed on this page --%>
<%@ taglib uri="taglib.tld" prefix="stl" %>
<stl:xslt xsl="shipping.xsl" />
.
.
Shipping XML
.
.
</stl:xslt>

</body>
</html>

--

Brian N. Burridge
Internet Architect
Ext 3515
The Internet Group - ITSS
Cox Target Media

"Until a person can say deeply and honestly, "I am what I am today because of the
choices I made yesterday," that person cannot say, "I choose otherwise."


David Wall wrote:

> > The problem with using JSP for generating XML is that the JSP wants to
> > assume that it is sitting at the  top level of your application, i.e. it
> > wants to send the response back to the client.
> > >From what I understand, your current architecture looks like this
> >
> > [db] <-----> [pl/sql] ---XML---> [XSL engine] --HTML via HTTP---> [client]
> >
> > If we try to introduce JSP into this scenario we get
> >
> > [db] <-----> [pl/sql] ---data---> [JSP] ---XML via HTTP--> [client]
> >
> > There is no room after the JSP layer to perform the XSL transformation
> > JSP does not allow for post processing of it's output in order to perform
> > the rendering. I believe this is because JSP is meant to be used in as
> > presentation generation language, not as a data mapping language. Sure,
> you
> > could chain this to another servlet which contained your rendering code,
> but
> > it is much cleaner to just have something like
> >
> > [db] <-----> [pl/sql] ---data---> [XML data mapping code] ---XML--> [XSL
> > engine] --XML/PDF/etc. via HTTP--> [client]
>
> A lot depends on whether you really "need" XSLT or not.  JSP is in many ways
> an XSLT transform, creating output from the data in beans.  XSLT transforms
> XML-formated data.  JSP transforms bean data.  Using both seems like
> overkill.  JSP has the advantage in that it can merge lots of different
> beans together, whereas XSLT works on only a single XML doc.  Of course, if
> your data comes out natively in XML format, then XSLT is a nice way to go.
>
> Realize that a lot of complex transforms via XSLT will likely be harder to
> get right than with JSPs.  For simple mapping, XSLT seems very powerful, but
> it can be a complex beast when doing more complex things.
>
> David
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> 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

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
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

Reply via email to