The <sql:setDataSource> doesn't allow the definition of a scoped configuration data source, i.e., a <sql:setDataSource> with attribute scope but without atribute var. I think the specification allows that (sorry if I misunderstood the specification :), according to the definition of the scope atribute on section 10.6: If var is specified, scope of the exported variable. Otherwise, scope of the data source configuration variable. The reason it doesn't work is that the JstlSqlTLV.java checks for dangling scope, as changed in the bug below: http://cvs.apache.org/viewcvs/jakarta-taglibs/standard/src/org/apache/taglibs/standard/tlv/JstlSqlTLV.java.diff?r1=1.6&r2=1.7 The fix is pretty simple, it's only a matter of adding an exception for the dangling rule to the setDataSource tag, as shown below: [felipeal@localhost]/usr/local/java/jakarta-taglibs-src/standard-1.0.3/src/org/apache/taglibs/standard/tlv: diff -u JstlSqlTLV.java JstlSqlTLV-patched.java --- JstlSqlTLV.java 2003-05-23 16:47:41.000000000 -0300 +++ JstlSqlTLV-patched.java 2003-05-23 16:47:30.000000000 -0300 @@ -155,7 +155,8 @@ SCOPE, qn, a.getValue(SCOPE))); if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) fail(Resources.getMessage("TLV_EMPTY_VAR", qn)); - if (qn.startsWith(prefix + ":") && hasDanglingScope(a)) + + if (qn.startsWith(prefix + ":") && hasDanglingScope(a) && !qn.startsWith(prefix + ":" + SETDATASOURCE)) fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn)); // now, modify state Regards, Felipe
I forgot to mention, but it looks like the code's logic already handle what the specifications says, the problem is really the TLV: SetDataSourceTagSupport.java, method doStartTag: if (var != null) { pageContext.setAttribute(var, ds, scope); } else { Config.set(pageContext, Config.SQL_DATA_SOURCE, ds, scope); }
Thanks for the report and the patch. This is now fixed.