tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eduardo Pelegri-Llopart <>
Subject Re: %=x% expression syntax bug in XML jsp?
Date Wed, 26 Sep 2001 20:55:33 GMT
One approach we also considered was a JSP action that can be used to
construct an XML element dynamically.

For example (shooting from the hip)

<jsp:element name="theAttributeName">
  <jsp:attribute name="theAttributename">Value</jsp:attribute>
  <jsp:attribute name="anotherAttributeName" value="inlineValue"/>

In your case that would be:

<jsp:element name="text">
 <jsp:attribute name="y" value="10"/>
 <jsp:attribute name="x" value="%=xpos%"/>

That is essentially what what XSLT does.  My recollection is that XSP
has something like that too.  This seems, to me, to be pretty in the
spirit of XML.   In the end we decided not to include this because it
can be written as a plain custom-action and we could wait before adding
it to the language.  I believe that the JSPTL 1.0 EG is talking about
adding such an action.

There are some other things that could be done in the JSP syntax,
including a new bodyContent property of a tag that requires it to be a
well formed XML document, plus an in-line expansion of expressions... 
But we never looked much into that part.

I do agree that we will be doing much more XML in the future, so I hope
that we will fine-tune the XML syntax in JSP 1.3 based on feedback from
all of you.


	- eduard/o

Mark Abbott wrote:
> Hi Craig -
> I'm curious whether the expert group has discussed what
> might be done in the future about this unfortunate
> aspect of JSP. In what I would think would be a
> really common case in the future, where one wants to
> design an app using clean, readable, and purely XML
> templates (perhaps XHTML for example), but editing by
> hand rather than with some JSP savvy tool, the choices
> are:
> > * Create a custom tag <foo:text> which just dumps out the
> >   corresponding <text> tag
> Wrapping all the tags in every markup of interest is impractical
> > * Write the XML syntax in the way that the JSP compiler expects:
> >    <jsp:text><![CDATA[<text y="10" x="]]>
> >    <jsp:expression>xpos</jsp:expression>
> >    <jsp:text><![CDATA[">test</test></jsp:text>
> This is an unreadable mess, especially considering scaling
> up to a substantial size of template
> > * Use the JSP syntax, where <%= %> expressions *are* recognized
> >   everywhere.
> This is not XML any more
>             Cheers - Mark

View raw message