Tuesday, 20 May 2008

DataTableTag broken in Sun's JavaServer Faces implementation (1.2-b20-FCS)

Error
The method setVar(String) in the type DataTableTag is not applicable for the arguments (JspValueExpression)

while using
Tomcat: 6.0.16
JSF: Sun's JavaServer Faces implementation (1.2-b20-FCS)

Cause
The root cause of this issue is, the definition of the "var" attribute of the dataTable tag in "html_basic.tld" does not match with signature of "setVar" method on com.sun.faces.taglib.html_basic com.sun.faces.taglib.html_basic.DataTableTag class.

The definition of "var" in the tag lib file is a "deferred-value" of type "java.lang.String"

which tells that JSP compiler that this is a "ValueExpression", hence it generates the following code

setVar(new org.apache.jasper.el.JspValueExpression("/HelloWorld.jsp(12,1) 'currentItem'",_el_expressionfactory.createValueExpression("currentItem",java.lang.String.class))

where as, the DataTableTag class expects setVar(String).

Workaround
Use a previous stable build. I used "jsf-1.2_07-b03-FCS".