• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem using a taglib with rtexprvalue set to true with tomcat

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I have to use a proprietary taglib (I could modify it if i need to) which use rtexprvalue set to true.

Until now, no problem. In fact, the problem occurs when i try to pass some arguments:

In my jsp, the taglib is called like

<mytaglib param="<%= MyClass.getValue(...) %>" />



where MyClass.getValue(...) is a method wich returns a string containing xml. To prevent some incorrect behaviour, xml characters and quotes are escaped into their html equivalents : < become &lt; , " become &quot;.

Let's take the example where MyClass.getValue() return the string "&lt; tag param1=&quot;abc&quot; /&gt;" (which basically correspond to <tag param1="abc" />).

I want escaped html characters remain inchanged. It is the case when i use an old version of wsad (version 5.1.1, which take about 90% of my memory and force me to go and take a coffee each time i want to run my appli) However, if i want to use tomcat, the behaviour is not the same and the application crash before calling the taglib code because the html characters are evaluated.

the error looks like (free traduction cause i use a localized version of tomcat, so error messages might be irrelevant) :

org.apache.jasper.JasperException: Unable to compile class for jsp
An error occurred at line :334 in jsp file :/WEB-INF/blablabla.jsp

_jspx_th_mytaglib_mytaglib_2.setParam("<tag param1="abc">")

So, what i want to do is to prevent tomcat (as wsad seem to handle it) escaping html characters when evaluating taglib parameter.

The jsp version i use is 1.1

Thanks.

[ August 23, 2006: Message edited by: Max Cok ]

[ August 23, 2006: Message edited by: Max Cok ]

[ August 23, 2006: Message edited by: Max Cok ]

[ August 23, 2006: Message edited by: Max Cok ]
[ August 23, 2006: Message edited by: Max Cok ]
 
Bartender
Posts: 1845
10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP1.1? That would be Tomcat3? Surely WSAD5.1 was JSP1.2?

The code generated makes it look like you are trying to set the attribute of a custom tag with another tag, which is invalid syntax.

The line of code you showed out of the created servlet
_jspx_th_mytaglib_mytaglib_2.setParam("<tag param1="abc">")
looks like it was created by the following line in a jsp:
<mytaglib param="<tag param1="abc" />" />

Just as a question, would the code run on Tomcat4 or 5 unchanged?
 
Max Cok
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the jsp code is created by a line that looks like this :

<mytaglib param='<%= "&lt;tag param1=&quot;" + MyClass.getValue() + "&quot; /&gt;" />' />

With wsad (jsp v 1.1, pretty old but those are the requirements on the appliction i work on), it works flawlessly, but with tomcat 5.0 (used with eclipse 3.2 + wtp), i couldn't have managed to make it work.
 
Max Cok
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I may have found the origin of the problem; It's tomcat parser wich replace the ""e" by '"' (see org.apache.jasper.compiler.Parser.parseQuoted()).

As i didn't see in the tomcat code a flag wich would have allowed me to disable those replacements, guess to only way to go through this problem ( except of course getting another servlet web engine) is to modify and recompile tomcat...
reply
    Bookmark Topic Watch Topic
  • New Topic