• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javascript code exploding the JSLT validation

 
Anoop Krishnan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you find out why the following jsp page


throws
the following exception .

PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: <h3>Validation error messages from TagLibraryValidator for c in /app/sdv/test.jsp</h3><p>null: org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x1b) was found in the CDATA section.</p>


I am using JSTL 1.1 core library with tlib-version 1.1 & Tomcat 5.5 on Linux
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What makes youi think that this is related to the JavaScript on your page?

uri="/WEB-INF/tld/c.tld"


What is c.tld doing outside of the jar file?

Did you extract the tld file and place it in the file system?

If so, this is the first thing to clean up.
 
Anoop Krishnan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I remove this line


There is no exception
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's odd. What about my other questions?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was able to recreate this problem. That's the good news...

P.S. That doesn;t mean that you shouldn;t consider cleaning up your setup. There is no reason for c.tld to be repeated in the file system.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64721
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It appears as if the character sequence \$ is being converted to an escape character (0x1b) by the JSP translator, which is subseuquently tripping up the JSTL validator.

You could try clever escaping to try to avoid this, but it might just be easier to hack it by separating the $ from the preceding slash with something like:



which makes me gag, but avoids the issue.
 
Anoop Krishnan
Ranch Hand
Posts: 163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot
I fixed the issue with the following code


But this is a big limitation that you have to be very carefull in writting javascript code when you incluse JSTL

isn't it ?

When I tried to use c.tld in the jar file for the following code I got compilation error.


According to TLD or attribute directive in tag file, attribute value does not accept any expressions


but when I extracted it to the file system and used it, it worked fine .
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic