> From: Zack Angelo [mailto:[EMAIL PROTECTED]] > > Hey, > > I have a statement along the lines of this in my XSP doc: > > String test = <xsp-session:get-attribute name="mySessionAttr"/>; > > However, it won't work (I get an incompatible types compiler error) > unless I cast it as a String. Consequently, I think it's returning an > invalid value. The same circumstances apply when I use > session.getAttribute() as well. Any ideas? Thanks in advance.
See http://xml.apache.org/cocoon/apidocs/org/apache/cocoon/environment/Reque st.html#getAttribute(java.lang.String): public java.lang.Object getAttribute(java.lang.String name) http://xml.apache.org/cocoon/apidocs/org/apache/cocoon/environment/Sessi on.html#getAttribute(java.lang.String): public java.lang.Object getAttribute(java.lang.String name) Which means that attributes are *objects*, not strings, and compiler is right. However, xsp-request logicsheet provides you with conversion abilities: <xsp:logic> String s = <xsp-request:get-attribute name="name" as="string"/>; Object o = <xsp-request:get-attribute name="name" as="object"/>; </xsp:logic> <!-- Generates XML tag <xsp-request:attribute>attr value here</xsp-request:attribute> --> <xsp-request:get-attribute name="name" as="xml"/> Same holds true for session attributes. Vadim > -Zack --------------------------------------------------------------------- Please check that your question has not already been answered in the FAQ before posting. <http://xml.apache.org/cocoon/faqs.html> To unsubscribe, e-mail: <[EMAIL PROTECTED]> For additional commands, e-mail: <[EMAIL PROTECTED]>