cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tuomo L <tleso...@cc.hut.fi>
Subject RE: getxml in XSP throws NPE if @path is invalid
Date Wed, 15 Oct 2003 07:08:32 GMT
Thanks, sounds like a solution. I'll give it a try! :)

-Tuomo

On Tue, 14 Oct 2003, Antonio Gallardo wrote:

> Tuomo L dijo:
> > Here's the line of code, that gives the error (No error, if
> > /authentication/data/bar/ is actually available. The "data" section is
> > created dynamically for every user, so "bar" is not always there and
> > error happens)
> >
> > String foo = <xsp-session-fw:getxml context="authentication"
> >              path="/authentication/data/bar"/>;
>
> Hi Tuomo:
>
> There is another attribute that can help you:
>
> as="string" (default) - returns the value of the given path as a String.
>
> as="object" returns the value of the given path as an Object
> (org.w3c.dom.DocumentFragment).
>
> as="xml" returns the value of the given path as an
> org.w3c.dom.DocumentFragment. The root of the DocumentFragment is
> <xsp-session-fw:xml>.
>
> Are you tried this attribute? Maybe it can helps you.
>
> The idea of the default as="string" is to let you add easily inside your
> XSP some strings. We are using to show the user name in a welcome page.
> Example:
>
> <p>Hi <xsp-session-fw:getxml context="authentication"
>       path="/authentication/data/full_name"/>, welcome back to the System</p>
>
> Of course in this example the @path always exists, so we don't need to
> test if the @path exists in the given session context.
>
> So, I recommend you use as="object", get the object and if the object is
> null, then there is nothing. Else the path exists so you can get the
> string.
>
> Please comment if this works for you. I am not sure if this will work,
> since Carsten did changes in the Helperclass in order to helps you.
>
> Best Regards,
>
> Antonio Gallardo.
>
>
>

Mime
View raw message