RE: %=x% expression syntax bug in XML jsp?
Ok. Thanks for the reply. I can see the arguments on both sides. It's a pitty my side lost ;) james -Original Message- From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 26, 2001 8:59 PM To: [EMAIL PROTECTED] Subject: Re: %=x% expression syntax bug in XML jsp? On Wed, 26 Sep 2001, Mark Abbott wrote: Date: Wed, 26 Sep 2001 10:43:51 -0700 From: Mark Abbott [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: %=x% expression syntax bug in XML jsp? 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:expressionxpos/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 There was *considerable* discussion about the details of the XML syntax. On this particular point, my take-away from the results was no particular desire to change a fundamental assumption from the very early days of JSP -- that JSP is totally agnostic to the syntax and semantics of the template text. To do as you suggest would require the JSP compiler to understand in some fashion that the template text it is processing is really element+attribute oriented (as XML and HTML are), so that it could apply this particular transformation the way you want. Also, the design center for the XML syntax was definitely around automatic generation from tools, rather than hand-editing. And it shows in use cases like this one. It's too late to do anything in a JSP 1.2 time frame (since the spec just went final), but it would certainly be worthwhile to log your suggestion to the spec feedback address for consideration in a future version: [EMAIL PROTECTED] Craig
Re: %=x% expression syntax bug in XML jsp?
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=theAttributenameValue/jsp:attribute jsp:attribute name=anotherAttributeName value=inlineValue/ /jsp:element In your case that would be: jsp:element name=text jsp:attribute name=y value=10/ jsp:attribute name=x value=%=xpos%/ /jsp:element 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. Thanks, - 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:expressionxpos/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
%=x% expression syntax bug in XML jsp?
Hi All, My reading of ParserXJspSaxHandler.java suggests that the shorthand expression syntax for jsp1.3 xml documents (%=x%) is not handled in 'uninterpreted' tags (ie: tags that are not taglibs or jsp:). Is this a bug or per spec? My reading of the spec suggests it's a bug, but i could well be missing something. The problem can be illustrated as follows: take this jsp page --- ?xml version=1.0 encoding=ISO-8859-1? jsp:root version=1.2 xmlns:jsp=http://java.sun.com/JSP/Page; jsp:directive.page contentType=test/xml+svg / jsp:scriptlet![CDATA[ String t = test; String xpos = 10; ]]/jsp:scriptlet jsp:text![CDATA[?xml version=1.0 encoding=ISO-8859-1 ? ]]/jsp:text svg width=100 height=100 xmlns='http://www.w3.org/2000/svg' text y=10 x=%=xpos%jsp:expressiont/jsp:expression/text /svg /jsp:root --- My problem is that the x=%=xpos% expression is not expanded (in tomcat 4.0), so the generated SVG document looks like snippet text y=10 x=%=xpos%test/text /snippet cheers, james -- James Uther www.F-Secure.com Senior Software Engineer F-Secure Corporation Securing the Mobile Enterprise
Re: %=x% expression syntax bug in XML jsp?
On Wed, 26 Sep 2001, Uther, James wrote: Date: Wed, 26 Sep 2001 14:30:21 +0300 From: Uther, James [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: %=x% expression syntax bug in XML jsp? Hi All, My reading of ParserXJspSaxHandler.java suggests that the shorthand expression syntax for jsp1.3 xml documents (%=x%) is not handled in 'uninterpreted' tags (ie: tags that are not taglibs or jsp:). Is this a bug or per spec? My reading of the spec suggests it's a bug, but i could well be missing something. My understanding (confirmed by talking with the JSP spec lead) is that this is not a bug, but is operating per design. If you made parsing %=x% work in template text (which is what the JSP compiler thinks you are processing when you're not inside a custom tag), then users would have to escape this kind of character string *everywhere*, not just in what looks like a tag attribute. Also, there's no requirement that the template text itself look like HTML or XML (i.e. it doesn't have to have a syntax that looks like elements with attributes). So, the JSP compiler cannot attach any semantic significance to what looks like a tag but is not a tag it recognizes (i.e. a built-in jsp:xxx tag or a defined custom tag). The problem can be illustrated as follows: take this jsp page --- ?xml version=1.0 encoding=ISO-8859-1? jsp:root version=1.2 xmlns:jsp=http://java.sun.com/JSP/Page; jsp:directive.page contentType=test/xml+svg / jsp:scriptlet![CDATA[ String t = test; String xpos = 10; ]]/jsp:scriptlet jsp:text![CDATA[?xml version=1.0 encoding=ISO-8859-1 ? ]]/jsp:text svg width=100 height=100 xmlns='http://www.w3.org/2000/svg' text y=10 x=%=xpos%jsp:expressiont/jsp:expression/text /svg /jsp:root --- My problem is that the x=%=xpos% expression is not expanded (in tomcat 4.0), so the generated SVG document looks like snippet text y=10 x=%=xpos%test/text /snippet That's correct, because text is not recognized as a custom tag. Choices: * Create a custom tag foo:text which just dumps out the corresponding text tag * Write the XML syntax in the way that the JSP compiler expects: jsp:text![CDATA[text y=10 x=]] jsp:expressionxpos/jsp:expression jsp:text![CDATA[test/test/jsp:text * Use the JSP syntax, where %= % expressions *are* recognized everywhere. cheers, james Craig McClanahan -- James Uther www.F-Secure.com Senior Software Engineer F-Secure Corporation Securing the Mobile Enterprise
Re: %=x% expression syntax bug in XML jsp?
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:expressionxpos/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
Re: %=x% expression syntax bug in XML jsp?
On Wed, 26 Sep 2001, Mark Abbott wrote: Date: Wed, 26 Sep 2001 10:43:51 -0700 From: Mark Abbott [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: %=x% expression syntax bug in XML jsp? 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:expressionxpos/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 There was *considerable* discussion about the details of the XML syntax. On this particular point, my take-away from the results was no particular desire to change a fundamental assumption from the very early days of JSP -- that JSP is totally agnostic to the syntax and semantics of the template text. To do as you suggest would require the JSP compiler to understand in some fashion that the template text it is processing is really element+attribute oriented (as XML and HTML are), so that it could apply this particular transformation the way you want. Also, the design center for the XML syntax was definitely around automatic generation from tools, rather than hand-editing. And it shows in use cases like this one. It's too late to do anything in a JSP 1.2 time frame (since the spec just went final), but it would certainly be worthwhile to log your suggestion to the spec feedback address for consideration in a future version: [EMAIL PROTECTED] Craig