Read up on the Model I versus the Model II articles. It gives a pretty good
indication of how well JSP can separate presentation from content. The
Model II is the more scalable way of separating presentation from content,
but you are essentially tied to the HTML for presentation.
Buenos Suerte,
Mick
-----Original Message-----
From: Eduardo Pelegri-Llopart
[SMTP:[EMAIL PROTECTED]]
Sent: Monday, January 24, 2000 10:01 AM
To: [EMAIL PROTECTED]
Subject: XML and JSP (was What does JSP really offer?)
Another thread in the replies was about XML and JSP.
On Wed, 19 Jan 2000, Mick Chang wrote:
> I kind of disagree that JSP provide a separation of presentation
and content
> logic.
Hopefully the tag library replies have addressed this point.
> I hear people talk about it, but I've yet to see a good demo that
scales
> with it.
We need more exapmles, I agree. But there are a number of "real
life"
sites out there that are using JSPs. For example, a few I like
include
"www.carorder.com", "www.wine.com" and "www.spray.se". There are
many
more.
> > Most people I've heard from think that a more scalable way to
separate
> > presentation from content logic is to use XML served up with
Servlets.
As some other people have said, it is not an either/or. One can use
JSP
to generate XML, or use XML to generate (X)HTML via a JSP.
Sylvain's
example below is of the first type:
Sylvain Randier wrote:
> I believe there is a way to separate content logic and design with
JSPs.
> JSP has kinda similarities with XML because the JSP tags follow
the XML
> syntax. You can also define your own JSP tags using tag libraries.
>
> But there are not enough examples about how to use tag libraries,
so if
> you have some, share them ;-) In fact I have developed a web
application
> with JSPs and faced with some lack of examples/doc about this
technology.
Yes, you are right, we are very thin on examples. There are several
books that are being cooked right now, and we plan to release a
number
of examples via an ASF project in jakarta. Stay tuned.
> The right thing will be I think to combine the best of both
worlds.
> Generate your XML with JSP:
> <?xml version="1.0" ?>
> <%@ page language="java" import="mypackage.*" %>
> <jsp:useBean id="myBean" scope="session" class="SessionBean" />
> <?xml-stylesheet type="text/xsl" href="<%=myBean.getXSLFileName()
%>" ?>
> <mytag>
> .....
> </mytag>
>
> Then, the browser requests a JSP file, returning XML content,
which can
> link with an XSL stylesheet as shown above.
>
> Some clients are able to display such XML files (Mozilla, IE5).
> In order to display HTML for older clients, tag libraries may be
used,
> enabling the page to be easily migrated to XML later.
Sylvain's last sentence relates to the second type I mentioned
earlier:
using XML form a JSP to generate (X)HTML - or to generate more XML.
For
example, you can define a tag of the form, say:
<x:applyXSLT source="anURLtoSource" style="aURLtoStyleSheet"
/>
whose sematics is to get the source an apply a stylesheet. This has
some cost in the current incarnation since (a) the Servlet
infrastructure does not provide a way to do this except by creating
a
new client request, and (b) the current XSLT implementatons are DOM
based (although I know james clark was looking into applying
transformations on event streams). We will be looking at these for
the
next version of the spec.
Also, some JSP vendors are already providing products that combine
JSP
and XSL. I konw that Caucho and IBM are doing that, and I think
that so
are Oracle and Allaire.
If you are interested in JSP, I'd encourage you to subscribe to
jsp-interest since most announcements and discussion happens there.
You
can always subscribe in digest mode to get 1 message a day.
Hope this helps,
- eduard/o
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in
the body
of the message "signoff SERVLET-INTEREST".
Archives:
http://archives.java.sun.com/archives/servlet-interest.html
Resources:
http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html