You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2003/03/17 15:52:42 UTC
DO NOT REPLY [Bug 18066] New: -
Unexpected behaviour of nested:define
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18066>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18066
Unexpected behaviour of nested:define
Summary: Unexpected behaviour of nested:define
Product: Struts
Version: 1.1 RC1
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Custom Tags
AssignedTo: struts-dev@jakarta.apache.org
ReportedBy: areus@ibit.org
nested:define has an implicit "name" value but it is not recognized by the TEI
class o.a.s.taglib.bean.DefineTei and scripting variables are generated with
type java.lang.String instead of java.lang.Object.
Ex:
We have a bean of class "org.ibit.A" stored unner the attribute "theA", with a
property "b" of class "org.ibit.B"
With bean:define
<bean:define id="theB" name="theA" property="b" />
<%--
theB has been created with type java.lang.Object
generated jsp -> java code:
theB = (java.lang.Object)pageContext.findAttribute("theB");
--%>
With nested:
<nested:root name="theA">
<nested:define id="theB" property="b" />
<%--
it tries to create theB with type java.lang.String throwing
a ClassCastException
generated jsp -> java code:
theB = (java.lang.String)pageContext.findAttribute("theB");
--%>
</nested:root>
The offending code seems to be in o.a.s.taglib.bean.DefineTei:
87 String type = (String)data.getAttribute("type");
88 Object name = data.getAttribute("name");
89 Object value = data.getAttribute("value");
90 if (type == null) {
91 if ( (value!=null) || (name==null) )
92 type = "java.lang.String";
93 else
94 type = "java.lang.Object";
95 }
It seems that in line 88 it returns null because it doesn't find the implicit
property name of the tag, so the type gets fixed to java.lang.String because
confition in line 91 returns null.
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-dev-help@jakarta.apache.org