Hi Manuel

Thanks - you've found a bug - am fixing it shortly, I'll let you know when
its done.

James
----- Original Message -----
From: "Manuel Tromm" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, September 10, 2001 2:29 PM
Subject: Re: XTags: Usage of org.dom4j.Documents?


> Hi James,
>
> thank you again for your help on my XTags-question.
> I hope you enjoyed your vacation.  ;-)
>
> I've tried it out with the latest XTags build and
> dom4j-1.0 under Tomcat 3.2.2.
>
> Using the <xtags:parse id="myDoc"> in combination with
> the <xtags:forEach context="<%= myDoc %>"> works fine,
> but passing in an org.dom4j.Document via the context
> attribute will lead the "forEach"-XTag to an exception.
> The exception always occurrs *after the last* iteration.
> What can I do? Have I done something wrong or is it a bug?
>
> I've attached a test JSP-File to this mail for you.
>
>
> Regards,
> Manuel
>
>
>
> <h1>Error: 500</h1>
> <h2>Location: /jsp/test_for_each_context.jsp</h2><b>Internal Servlet
> Error:</b><br><pre>javax.servlet.ServletException
> at
>
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
> l.java:459)
> at
>
jsp._0002fjsp_0002ftest_0005ffor_0005feach_0005fcontext_0002ejsptest_0005ffo
>
r_0005feach_0005fcontext_jsp_0._jspService(_0002fjsp_0002ftest_0005ffor_0005
>
feach_0005fcontext_0002ejsptest_0005ffor_0005feach_0005fcontext_jsp_0.java:1
> 34)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
> va:130)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:282)
> at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
> at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
> </pre>
> <b>Root cause:</b>
> <pre>java.lang.NullPointerException
> at java.util.Hashtable.put(Hashtable.java:380)
> at
>
org.apache.jasper.runtime.PageContextImpl.setAttribute(PageContextImpl.java:
> 258)
> at
> org.apache.taglibs.xtags.xpath.TagHelper.setInputNodes(TagHelper.java:160)
> at
> org.apache.taglibs.xtags.xpath.ForEachTag.doAfterBody(ForEachTag.java:154)
> at
>
jsp._0002fjsp_0002ftest_0005ffor_0005feach_0005fcontext_0002ejsptest_0005ffo
>
r_0005feach_0005fcontext_jsp_0._jspService(_0002fjsp_0002ftest_0005ffor_0005
>
feach_0005fcontext_0002ejsptest_0005ffor_0005feach_0005fcontext_jsp_0.java:1
> 15)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.ja
> va:130)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
>
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
> va:282)
> at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
> at org.apache.tomcat.core.Handler.service(Handler.java:287)
> at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> at
>
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
> 7)
> at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
> at
>
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
> onnectionHandler.java:213)
> at
> org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
> at
> org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
> at java.lang.Thread.run(Thread.java:484)
> </pre>
>
>
>
> -----Ursprüngliche Nachricht-----
> Von: James Strachan [mailto:[EMAIL PROTECTED]]
> Gesendet: Sonntag, 9. September 2001 21:21
> An: [EMAIL PROTECTED]
> Betreff: Re: XTags: Usage of org.dom4j.Documents?
>
>
> Hi Manuel
>
> Sorry for the delay getting back to you, I'm just back from vacation.
>
> The quick answer is absolutely yes - you can pass in documents, nodes or
> 'node sets' (a List of Node objects) to all the tags. This is achieved via
> either the context attribute using a scriptlet expression or via XPath
> variables.
>
> e.g.
>
> <xtags:forEach select="foo/bar" context="<%= mydoc %>">
>     ...
> </xtags:forEach>
>
> You can define a variable for any expression or parse to allow you to
> evaluate once and keep it around for future reference.
>
> e.g.
>
> <xtags:parse id="mydoc">
>     <some>
>         <tag>hello there</tag>
>     </some>
> </xtags:parse>
>
> then later...
>
> <xtags:valueOf select="/some/tag" context="<%= mydoc %>"/>
>
> or you could use the XPath variables. Whenever an attribute is defined in
> page / request / session / application scope it is available as an XPath
> variable. So you could rewrite the above as
>
> <xtags:valueOf select="$mydoc/some/tag"/>
>
> You can also use the <xtags:variable> tag to define a variable of an XPath
> expression, to avoid reevaluation. e.g.
>
> <xtags:variable id="mytags" select="//tag"/>
>
> Of course you could always define your own scripting variables for
documents
> and pass them in as a context parameter or create your own attributes and
> use the XPath variable syntax.
>
> Hope that helps.
>
> James
> ----- Original Message -----
> From: "Manuel Tromm" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, September 06, 2001 9:36 AM
> Subject: XTags: Usage of org.dom4j.Documents?
>
>
> > Hi folks,
> >
> > I've got a question about using XTags:
> >
> > The common way to use the XTags, is to parse an XML document
> > from somewhere by using the "<xtags:parse>"-Tag.
> > After the XML-Code has been parsed, it can be accessed
> > by the different "X"-Tags...
> >
> > Sometimes I have to use the XML-Source
> > (that is needed as input for XTags) twice or more or
> > at completely different locations of my web-application.
> > For this reason I've added the XML-Code to a cache.
> > The problem is now, that every time when the XTags-JSP is
> > requested, the XML-Input has to be parsed by the XTags again.
> > That means a lack of performance.
> >
> > Now my question: Because the XTags are built on top
> > of the dom4j, I'd like to know if there is any way to use
> > an (already parsed!) org.dom4j.Document as input for
> > XTags, so that I don't have to parse XML-Sources twice?
> > If yet there is no way, I'd like to ask the developers
> > to provide an appropriate Tag, because I think it would be
> > also quite helpful for other users.
> >
> > Does someone know a solution?
> >
> >
> > Regards,
> > Manuel Tromm
> >
>


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to