You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by "Brian J. Sletten" <bs...@nova.org> on 2002/05/07 21:15:29 UTC

Stupid question

I apologize in advance for asking a basic question, but for whatever 
reason I can't find the answer anywhere.

I am trying to parse an XML document stored as a String with an 
application scope and I can't get the stupid syntax straightened out.

The documentation talks about things like $application:foo, but that 
keeps causing parse to complain about unexpected semi-colons and 
whatnot. Without that, it just can't seem to find the reference.

Can anyone point me in the right direction?

TIA,

Brian

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Stupid question

Posted by Shawn Bayern <ba...@essentially.net>.
On Tue, 7 May 2002, Brian J. Sletten wrote:

> >   <x:parse xml="${textDocument}" var="foo" scope="application"/>
> 
> Hmm... this is what I was trying and it was complaining about the xml
> resolving to null. Here is scope indicates where the parsed document
> "foo" will live, right? It isn't saying where to find the
> textDocument.

Right.

> So, given that I tried that syntax, can anyone tell me if the
> following is correct for putting something into the Application scope
> from a Struts action?
> 
> servlet.getServletContext().setAttribute("textDocument", textDocument);

This looks correct too.  And ${textDocument} will find the text document
in any scope, so this lokos like it ought to work.

> The JSP compilation wouldn't happen before the Action were created,
> would it?

It isn't JSP compilation but runtime that's important.  Still, I don't
know enough of the details of Struts to be able to answer that, but you
can try retrieving the text document manually before parsing it, just as a
debugging strategy.  For instance:

  textDocument is '<c:out value="${textDocument}"/>'

or

 <%= pageContext.findAttribute("textDocument") %>

-- 
Shawn Bayern
"JSP Standard Tag Library"   http://www.jstlbook.com
(coming this summer from Manning Publications)


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Stupid question

Posted by "Brian J. Sletten" <bs...@nova.org>.
>   <x:parse xml="${textDocument}" var="foo" scope="application"/>

Hmm... this is what I was trying and it was complaining about the xml 
resolving to null. Here is scope indicates where the parsed document 
"foo" will live, right? It isn't saying where to find the textDocument.

So, given that I tried that syntax, can anyone tell me if the following is 
correct for putting something into the Application scope from a Struts 
action?

servlet.getServletContext().setAttribute( "textDocument", textDocument );

The JSP compilation wouldn't happen before the Action were created, 
would it?

Thanks, Shawn.


-- 




--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Stupid question

Posted by Shawn Bayern <ba...@essentially.net>.
If you're referring to JSTL, then the syntax would be
${applicationScope.foo} in th EL and $applicationScope:foo in XPath.  As
in:

  <x:parse xml="${textDocument}" var="foo" scope="application"/>
  <x:out select="$applicationScope:foo/bar"/>

-- 
Shawn Bayern
"JSP Standard Tag Library"   http://www.jstlbook.com
(coming this summer from Manning Publications)

On Tue, 7 May 2002, Brian J. Sletten wrote:

> I apologize in advance for asking a basic question, but for whatever 
> reason I can't find the answer anywhere.
> 
> I am trying to parse an XML document stored as a String with an 
> application scope and I can't get the stupid syntax straightened out.
> 
> The documentation talks about things like $application:foo, but that 
> keeps causing parse to complain about unexpected semi-colons and 
> whatnot. Without that, it just can't seem to find the reference.
> 
> Can anyone point me in the right direction?
> 
> TIA,
> 
> Brian
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>