« Porting from Tomcat to OC4J, Part II: JNDI names | Main | Improve Text Display in JDeveloper and SQLDeveloper »

Porting from Tomcat to OC4J, Part III: Correct Use of Quotes

If you're writing a token parser it might be very clear to you what a line like this mean to your parser:
    <td width="100%"
style="border-left: 1px solid #000; border-right: 1px solid #000;
<dhv:evaluate if="<%= !i.hasNext() %>">border-bottom: 1px
solid #000;</dhv:evaluate>">


Hard to spot isn't it?
Well, the problem is the second quote in the style attribute:
    style="border-left: 1px solid #000; border-right: 1px solid #000;
<dhv:evaluate if="<%= !i.hasNext() %>">border-bottom: 1px
solid #000;</dhv:evaluate>">


Tomcat silently handles this incorrect code as correct and will continue.
OC4J on the other hand follows the JSP and Servlet Specifications very close and issues an error.

To solve this problem, you should:

  • Read the quote character (") as parenthese and always translate it to open/close semantics.
  • Use the right quote character for inner attribute values, eg.
    <td width="100%"
    style="border-left: 1px solid #000; border-right: 1px solid #000;
    <dhv:evaluate if='<%= !i.hasNext() %>'>border-bottom: 1px
    solid #000;</dhv:evaluate>">

Credit

This flaw was also discussed on the OTN Forum.




Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on August 4, 2006 1:18 PM.

The previous post in this blog was Porting from Tomcat to OC4J, Part II: JNDI names.

The next post in this blog is Improve Text Display in JDeveloper and SQLDeveloper.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle