You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Konstantin Kolinko <kn...@gmail.com> on 2009/10/26 16:47:08 UTC

Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

2009/10/26 Christopher Schultz <ch...@christopherschultz.net>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Pete,
>
> On 10/24/2009 4:20 PM, Pete McNeil wrote:
>> This doesn't work / causes the error:
>>
>>        <jsp:include page="/includes/navTab.jsp" flush="true">
>>                <!-- InstanceBeginEditable name="navTopParam" -->
>>                <jsp:param name="navTopParam" value="products" />
>>                <!-- InstanceEndEditable -->
>>        </jsp:include>
>>
>> This does work:
>>
>>        <!-- InstanceBeginEditable name="navTopParam" -->
>>        <jsp:include page="/includes/navTab.jsp" flush="true">
>>                <jsp:param name="navTopParam" value="home" />
>>        </jsp:include>
>>        <!-- InstanceEndEditable -->
>
> This looks like a bug in the code that reads the JSP: comments ought to
> be tolerated and ignored. Would you be willing to:
>

Those are NOT comments. The JSP comments are <%-- --%>.

I think that if you switch to XML syntax for JSP pages (using jspx
files instead of jsp), those will be treated as XML comments and
properly ignored.

> 1. Log a bug against Tomcat in bugzilla
> 2. produce a short test case (the above is fine, but make sure it "works")
> 3. attach that test case to the newly-filed bug

So I am sure that the above is not a Tomcat bug.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Konstantin Kolinko <kn...@gmail.com>.
2009/10/27 Pete McNeil <ma...@microneil.com>:
>
> IMO allowing for the XML comments _seems_ like a good idea.
>

2009/10/26 Christopher Schultz <ch...@christopherschultz.net>:
> On the other hand, shouldn't the JSP compiler pass-through everything
> except for directives? HTML is a common enough use case for JSP that
> SGML comments ought to be tolerated in these cases.
>

Just an obvious reminder: although those are SGML comments, they are
not ignored by browsers.

E.g. in SCRIPT, STYLE tags, or IE specific <!--[if .. conditional
clauses (never used and don't remember their syntax). Also I think
that they might be visible through DOM (don't know whether it is
actually true).

Thus, those comments are just like the other text on the page.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Pete McNeil <ma...@microneil.com>.
Christopher Schultz wrote:

<snip/>

> I think the JSP specification has a little multiple-personality disorder
> when it comes to XML-looking-syntax versus actual XML syntax. It's
> unfortunate, since it can really confuse people.
>   

My $0.03

"be strict in what you produce, be forgiving in what you receive"


IMO allowing for the XML comments _seems_ like a good idea.

None the less we're modifying that code to be more correct -- even if 
the specs are a little ambiguous it seems more correct to treat the 
entire <jsp:include.../> as a single entity in this case and not slice 
it up with comments for whatever reasons.

_M


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Bill Barker <bi...@verizon.net>.
"Christopher Schultz" <ch...@christopherschultz.net> wrote in message 
news:4AE758A0.5050909@christopherschultz.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Bill,
>
> On 10/26/2009 9:44 PM, Bill Barker wrote:
>> "Christopher Schultz" <ch...@christopherschultz.net> wrote in message
>>> On the other hand, shouldn't the JSP compiler pass-through everything
>>> except for directives? HTML is a common enough use case for JSP that
>>> SGML comments ought to be tolerated in these cases.
>>
>> Except for the fact that section 5.4 of the (2.1) JSP spec precludes 
>> having
>> anything except <jsp:param /> in the body of a <jsp:include> element.
>> Allowing template text in there is then a Container-specific feature and 
>> so
>> renders the webapp non-portable.
>
> I read 5.4 and while the text doesn't say anything about this, the
> formal syntax of <jsp:include> does:
>
> "
> Syntax
> [...]
> <jsp:include page="urlSpec" flush="true|false">
> { <jsp:param .... /> }*
> </jsp:include>
> "
>
> There, no other content appears to be allowed. However, other sections
> of the JSP specification are less ambiguous. For instance, section 5.15
> (<jsp:text>) specifically says:
>
> "
> No subelements may appear within jsp:text; for example the following
> fragment is invalid and must generate a translation error.
> "
>
> The closest 5.4 comes is this:
>
> "
> A jsp:include action may have jsp:param subelements that can provide
> values for some parameters in the request to be used for the inclusion.
> "
>
> Back to section 5.15, this is an interesting tidbit:
>
> "
> When within a JSP document, of course, the body content needs to
> additionally conform to the constraints of being a well-formed XML
> document, so the following example, although valid in a JSP page is
> invalid in a JSP document:
> "
>
> The above is not qualified by anything mentioning the difference between
> .jsp and .jspx files or anything like that. I would expect that any
> SGML-style comments within a <jsp:text> element would, in fact, be
> ignored by the JSP processor when producing output since it presupposes
> XML semantics. Instead, the JSP compiler (in my 5.5.26 environment)
> produces an error for this document:
>
> <jsp:text>
> <!-- This is a SGML-style comment -->
> </jsp:text>

Within the spec, "JSP document" is the same as ".jspx", whereas "JSP page" 
is the same as ".jsp".

I've confirmed that this example causes an exception in 6.0 (using latest 
checkout from svn) when used in ".jsp" syntax (it works fine in ".jspx" 
syntax, and just outputs a blank line).  Since SGML comments are simply 
template text in ".jsp" syntax, it looks like you have found a bug.  This 
would be especially true if:
  <jsp:text>
     This is some content ${foo.content < 3}
  </jsp:text>
fails, but haven't tested it.

>
> The error is:
>
> Exception: org.apache.jasper.JasperException: /test.jsp(3,0) '&amp;lt;',
> when appears in the body of &amp;lt;jsp:text&amp;gt;, must be
> encapsulated within a CDATA
> Stack Trace:
> org.apache.jasper.JasperException: /test.jsp(3,0) &apos;&amp;lt;&apos;,
> when appears in the body of &amp;lt;jsp:text&amp;gt;, must be
> encapsulated within a CDATA
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
>
> This error seems consistent with the "no subelements" clause in S.5.15,
> but I see no such restriction placed on <jsp:include>.
>
>> It would be a bug if the error happened for a page in XML syntax however.
>
> I think the JSP specification has a little multiple-personality disorder
> when it comes to XML-looking-syntax versus actual XML syntax. It's
> unfortunate, since it can really confuse people.
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkrnWJ8ACgkQ9CaO5/Lv0PBhkgCdHL88GleiLT4mo4wf2K3q9DTD
> zB8An1Lk12w/HqvPZYPxbWERfJSJauln
> =4VVb
> -----END PGP SIGNATURE----- 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bill,

On 10/26/2009 9:44 PM, Bill Barker wrote:
> "Christopher Schultz" <ch...@christopherschultz.net> wrote in message 
>> On the other hand, shouldn't the JSP compiler pass-through everything
>> except for directives? HTML is a common enough use case for JSP that
>> SGML comments ought to be tolerated in these cases.
> 
> Except for the fact that section 5.4 of the (2.1) JSP spec precludes having 
> anything except <jsp:param /> in the body of a <jsp:include> element. 
> Allowing template text in there is then a Container-specific feature and so 
> renders the webapp non-portable.

I read 5.4 and while the text doesn't say anything about this, the
formal syntax of <jsp:include> does:

"
Syntax
[...]
<jsp:include page=”urlSpec” flush="true|false">
{ <jsp:param .... /> }*
</jsp:include>
"

There, no other content appears to be allowed. However, other sections
of the JSP specification are less ambiguous. For instance, section 5.15
(<jsp:text>) specifically says:

"
No subelements may appear within jsp:text; for example the following
fragment is invalid and must generate a translation error.
"

The closest 5.4 comes is this:

"
A jsp:include action may have jsp:param subelements that can provide
values for some parameters in the request to be used for the inclusion.
"

Back to section 5.15, this is an interesting tidbit:

"
When within a JSP document, of course, the body content needs to
additionally conform to the constraints of being a well-formed XML
document, so the following example, although valid in a JSP page is
invalid in a JSP document:
"

The above is not qualified by anything mentioning the difference between
.jsp and .jspx files or anything like that. I would expect that any
SGML-style comments within a <jsp:text> element would, in fact, be
ignored by the JSP processor when producing output since it presupposes
XML semantics. Instead, the JSP compiler (in my 5.5.26 environment)
produces an error for this document:

<jsp:text>
<!-- This is a SGML-style comment -->
</jsp:text>

The error is:

Exception: org.apache.jasper.JasperException: /test.jsp(3,0) '&amp;lt;',
when appears in the body of &amp;lt;jsp:text&amp;gt;, must be
encapsulated within a CDATA
Stack Trace:
org.apache.jasper.JasperException: /test.jsp(3,0) &apos;&amp;lt;&apos;,
when appears in the body of &amp;lt;jsp:text&amp;gt;, must be
encapsulated within a CDATA
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)

This error seems consistent with the "no subelements" clause in S.5.15,
but I see no such restriction placed on <jsp:include>.

> It would be a bug if the error happened for a page in XML syntax however.

I think the JSP specification has a little multiple-personality disorder
when it comes to XML-looking-syntax versus actual XML syntax. It's
unfortunate, since it can really confuse people.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrnWJ8ACgkQ9CaO5/Lv0PBhkgCdHL88GleiLT4mo4wf2K3q9DTD
zB8An1Lk12w/HqvPZYPxbWERfJSJauln
=4VVb
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Bill Barker <bi...@verizon.net>.
"Christopher Schultz" <ch...@christopherschultz.net> wrote in message 
news:4AE5CABB.7070304@christopherschultz.net...
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Konstantin,
>
>> Those are NOT comments. The JSP comments are <%-- --%>.
>>
>> I think that if you switch to XML syntax for JSP pages (using jspx
>> files instead of jsp), those will be treated as XML comments and
>> properly ignored.
>
> Apologies for not thinking about that: Pete, if you're not using XML
> syntax (as I expected you were), then your complaint is not valid: your
> JSP is /not/ an XML document.
>
> If you use .jspx (I think?), then XML syntax will be acceptable.
>
>> So I am sure that the above is not a Tomcat bug.
>
> On the other hand, shouldn't the JSP compiler pass-through everything
> except for directives? HTML is a common enough use case for JSP that
> SGML comments ought to be tolerated in these cases.
>

Except for the fact that section 5.4 of the (2.1) JSP spec precludes having 
anything except <jsp:param /> in the body of a <jsp:include> element. 
Allowing template text in there is then a Container-specific feature and so 
renders the webapp non-portable.

It would be a bug if the error happened for a page in XML syntax however.

> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAkrlyrsACgkQ9CaO5/Lv0PDDGACglcZR5X+kwfi1y2w82Sb5nuW5
> hioAn1I2ZY0r3CZSanzU9TpMyHEXWfTr
> =XZ+i
> -----END PGP SIGNATURE----- 




---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

> Those are NOT comments. The JSP comments are <%-- --%>.
> 
> I think that if you switch to XML syntax for JSP pages (using jspx
> files instead of jsp), those will be treated as XML comments and
> properly ignored.

Apologies for not thinking about that: Pete, if you're not using XML
syntax (as I expected you were), then your complaint is not valid: your
JSP is /not/ an XML document.

If you use .jspx (I think?), then XML syntax will be acceptable.

> So I am sure that the above is not a Tomcat bug.

On the other hand, shouldn't the JSP compiler pass-through everything
except for directives? HTML is a common enough use case for JSP that
SGML comments ought to be tolerated in these cases.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkrlyrsACgkQ9CaO5/Lv0PDDGACglcZR5X+kwfi1y2w82Sb5nuW5
hioAn1I2ZY0r3CZSanzU9TpMyHEXWfTr
=XZ+i
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Expecting "jsp:param" - Porting resin jsp pages to tomcat, dreamweaver editable sections / comments

Posted by Pete McNeil <ma...@microneil.com>.
Konstantin Kolinko wrote:

<snip/>

>> This looks like a bug in the code that reads the JSP: comments ought to
>> be tolerated and ignored. Would you be willing to:
>>
>>     
>
> Those are NOT comments. The JSP comments are <%-- --%>.
>
> I think that if you switch to XML syntax for JSP pages (using jspx
> files instead of jsp), those will be treated as XML comments and
> properly ignored.
>   
That makes some sense. My initial thought was that resin was being more 
forgiving in some way. Now we know how.

Thanks,

_M


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org