Thursday, March 28, 2013

JSP compiler, difference between Tomcat and WebLogic

In Tomcat I had some rather nasty EL code to get a BLOB value from a table:


<c:set var="sqlStatement2" value="select DATA_VALUE 
from ${datatable} where MSG_GUID = '${theMSGGUIDvalue}' "/>


<sql:query var="msgguidDataResult" dataSource="${domainds}">
 ${sqlStatement2}
</sql:query>

<c:set var="DATA_VALUE" value="${msgguidDataResult.rowsByIndex[0][0]}" 
scope="request"/>




In Tomcat this was working, in WebLogic it was giving:

Syntax error in expression. Encountered "(". Expected one of : "}", ".", "[", ">", "gt", "<", "lt", ">=", "ge", "<=", "le", "==", "eq", "!=", "ne", "&&", "and", "||", "or", "*", "+", "-", "?", "/", "div", "%", "mod",

It turns out that in WebLogic you must change the syntax to:

<c:set var="DATA_VALUE" value="${msgguidDataResult.rowsByIndex[0][0]}" scope="request"/>

It's just one of those things...

2 comments:

Unknown said...

I don't see any difference between the strings. Could you highlight the change for me please? Thanks

vernetto said...

doh, you are right... the weblogic one is correct, the problem is that I can't find any more the tomcat version ...