cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <>
Subject RE: xsp-session:get-attribute not returning a String?
Date Thu, 02 May 2002 23:52:24 GMT
> From: Zack Angelo []
> 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.


public java.lang.Object getAttribute(java.lang.String name)

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

String s = <xsp-request:get-attribute name="name" as="string"/>;
Object o = <xsp-request:get-attribute name="name" as="object"/>;
  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.


> -Zack

Please check that your question has not already been answered in the
FAQ before posting. <>

To unsubscribe, e-mail: <>
For additional commands, e-mail: <>

View raw message