[5] EL parsing eats extra character after '?'

2003-05-31 Thread Tim Funk
Attached below is a message from tomcat-user. I don't know it this is a valid 
issue or not. If its not, it has great FAQ potential.

If it is a problem, could it be caused by the following the snippet below? It 
looks like any custom tag would be ignored if preceded by a $. This seems to 
be the behavior I saw when I put $ in front of the hello world tag in 
/jsp-examples/jsp2/tagfiles/hello.jsp.

In org.apache.jasper.compiler.Parser.parseXMLTemplateText()
lines 1502, 1506
if (ch != '{') {
ttext.write('$');
ttext.write(ch);
continue;
}
I really don't know much about Jasper, and was just snooping.

-Tim

 Original Message 
Subject: Tomcat 5.0.2 Bug
Date: Fri, 30 May 2003 06:36:04 -0700 (PDT)
From: Ed Smith [EMAIL PROTECTED]
Reply-To: Tomcat Users List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
I think there is a bug in Tomcat 5.0.2 (at least under
Windows XP) dealing with placing a $ before (at least
some) tags.
Consider the following JSP:

jsp:useBean id=login class=LoginBean
scope=session/
jsp:setProperty name=login property=username
value=foo/
html
  body
$jsp:getProperty name=login
property=username/
  /body
/html
In Tomcat 4.1.24, this generates the following HTML
(as expected)
html
  body
$foo
  /body
/html
In Tomcat 5.0.2, it generates

html
  body
$jsp:getProperty name=login
property=username/
  /body
/html
The jsp taglib does not get processed in
5.0.2.  Note that if I add a space after the $, it
works in 5.0.2
Changing to

$ jsp:getProperty name=login property=username/

gets the following HTML

html
  body
$ foo
  /body
/html
Am I missing something?  I didnt find the problem in
either the bugs database or the mailing list archives.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: [5] EL parsing eats extra character after '?'

2003-05-31 Thread Kin-Man Chung

 Date: Fri, 30 May 2003 13:47:01 -0400
 From: Tim Funk [EMAIL PROTECTED]
 Subject: [5] EL parsing eats extra character after '?'
 To: Tomcat Developers List [EMAIL PROTECTED]
 Cc: [EMAIL PROTECTED]
 
 Attached below is a message from tomcat-user. I don't know it this is a valid 
 issue or not. If its not, it has great FAQ potential.
 
Argh, this is a bug!  JSP 2.0 now recognizes ${...} as an EL expression,
so there are some special handling for $ in the parser.  It got this
wrong, apparently.

I'll commit a fix to this as soon as I send this mail out.  Note that
the workaound to this problem is to write

\$jsp:getProperty name=login property=username/

instead.  Here, \$ is an escape for $.  This is new in JSP 2.0. 

Note also that this can now be written as

\$${login.username}

taking advantage of EL in tc 5.

 If it is a problem, could it be caused by the following the snippet below? It 
 looks like any custom tag would be ignored if preceded by a $. This seems to 
 be the behavior I saw when I put $ in front of the hello world tag in 
 /jsp-examples/jsp2/tagfiles/hello.jsp.
 
 
 In org.apache.jasper.compiler.Parser.parseXMLTemplateText()
 lines 1502, 1506
  if (ch != '{') {
  ttext.write('$');
  ttext.write(ch);
  continue;
  }
 
This would not work, since parseXMLTemplateText deals only with
text in the body of jsp:text element.

 
 I really don't know much about Jasper, and was just snooping.
 

Well, this is a good time to do that, now that Jasper in TC5 has
stablized.  Ping me if you need help.  :)

-Kin-man

 -Tim
 
  Original Message 
 Subject: Tomcat 5.0.2 Bug
 Date: Fri, 30 May 2003 06:36:04 -0700 (PDT)
 From: Ed Smith [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 
 I think there is a bug in Tomcat 5.0.2 (at least under
 Windows XP) dealing with placing a $ before (at least
 some) tags.
 
 Consider the following JSP:
 
 jsp:useBean id=login class=LoginBean
 scope=session/
 jsp:setProperty name=login property=username
 value=foo/
 
 html
body
  $jsp:getProperty name=login
 property=username/
/body
 /html
 
 In Tomcat 4.1.24, this generates the following HTML
 (as expected)
 
 html
body
  $foo
/body
 /html
 
 In Tomcat 5.0.2, it generates
 
 html
body
  $jsp:getProperty name=login
 property=username/
/body
 /html
 
 The jsp taglib does not get processed in
 5.0.2.  Note that if I add a space after the $, it
 works in 5.0.2
 
 Changing to
 
 $ jsp:getProperty name=login property=username/
 
 gets the following HTML
 
 html
body
  $ foo
/body
 /html
 
 Am I missing something?  I didn’t find the problem in
 either the bugs database or the mailing list archives.
 
 
 
 -
 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]