On 5/2/05, Woodchuck <[EMAIL PROTECTED]> wrote:
> JSTL is da bomb! :)
Indeed it is. If you actually need to create XML in a response to an
XmlHttpRequest call from an Ajax client side gadget :-), here's an
approach using a JSP 2.0 page (in xml syntax) that uses JSTL to
iterate over a result set, and JSP expressions to pull out the data
(copied from the Shale Use Cases example app):
--------------------
<jsp:root version="2.0"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:jsp="http://java.sun.com/JSP/Page">
<jsp:directive.page
contentType="text/xml;charset=UTF-8"/>
<categories>
<c:forEach var="category"
items="${lookup$listCategories.supportedCategories}">
<category>
<label>${category.label}</label>
<value>${category.value}</value>
</category>
</c:forEach>
</categories>
</jsp:root>
--------------------
The business logic that looks up the label/value pairs for the
response doesn't have a clue how it will actually be rendered, and
setting up a JSP page is much easier to author than building an XML
DOM in Java code.
Craig
>
> --- Rick Reumann <[EMAIL PROTECTED]> wrote:
> > Dakota Jack wrote the following on 5/2/2005 4:01 PM:
> > >
> > > The other aspect that is not discussed above is the removal of the
> > > complexity from the "page". This is where JSP, Taglibs, etc., come
> > > into the picture. And, I suspect, you two are talking about a
> > > combination of this problem (keeping the page simple) and the
> > previous
> > > problem (using a reasonable architecture).
> >
> > yes. For example, take a table sort example. I like being able to use
> >
> > JSTL (or even a display tag if that suits you) to display the
> > collection
> > info into the display of the table.
> >
> > Doing something like this within a servlet (Action) wouldn't really
> > be
> > wrong, but just more difficult to maintain and more of pain to code
> > (using StringBuffer and append bla bla).
> >
> > --
> > Rick
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]