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 "Johnson, Chris" <ch...@ti.com> on 2004/03/29 20:57:45 UTC

xml (JDOM) question

Is it possible to (or how would you) attach a JDOM object (if possible)
as an application attribute in a servlet and then forward to a jsp page
to process it?
 
Currently I'm doing the opposite, I'm starting with a jsp page and then
doing an import which is calling a servlet that's outputting text/xml.
I'm then x:parse'ng that and using xslt from there.  But I want to start
controlling things from the servlet side instead, and pushing the output
(JDOM currently) to the jsp page(s).
 
I don't seem to be finding an answer to this in all of the stuff I've
read.
 
BTW, I've gone the route of using java code in the jsp page using
scripting elements (<%...%>), but I was doing the looping and formatting
that way as well and it was REALLY ugly.  But, if I had to use a hybrid
approach, I will (i.e. using scripting to convert the Element to a
string for parsing with x:parse or something like that).
 
Anyway, hopefully I made some sense.  Any help would be much
appreciated.
 
Thanks,
Chris

Re: xml (JDOM) question

Posted by Kris Schneider <kr...@dotech.com>.
Just a note that the Standard taglib (or XTags probably) won't really know what
to do with a JDOM Document or Element. JDOM provides a DOMOutputter class that
will convert a JDOM Document into a DOM Document if you still want to go that
route.

Quoting Bill Siggelkow <bi...@bellsouth.net>:

> Chris, you should be able to add the JDOM object into the servlet 
> context from the servlet -- something like:
> 
> this.getServletContext.setAttribute("jdomObject", jdomObject);
> 
> Then use a RequestDispatcher to forward to your JSP.
> 
> Johnson, Chris wrote:
> 
> > Is it possible to (or how would you) attach a JDOM object (if possible)
> > as an application attribute in a servlet and then forward to a jsp page
> > to process it?
> >  
> > Currently I'm doing the opposite, I'm starting with a jsp page and then
> > doing an import which is calling a servlet that's outputting text/xml.
> > I'm then x:parse'ng that and using xslt from there.  But I want to start
> > controlling things from the servlet side instead, and pushing the output
> > (JDOM currently) to the jsp page(s).
> >  
> > I don't seem to be finding an answer to this in all of the stuff I've
> > read.
> >  
> > BTW, I've gone the route of using java code in the jsp page using
> > scripting elements (<%...%>), but I was doing the looping and formatting
> > that way as well and it was REALLY ugly.  But, if I had to use a hybrid
> > approach, I will (i.e. using scripting to convert the Element to a
> > string for parsing with x:parse or something like that).
> >  
> > Anyway, hopefully I made some sense.  Any help would be much
> > appreciated.
> >  
> > Thanks,
> > Chris

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: xml (JDOM) question

Posted by Bill Siggelkow <bi...@bellsouth.net>.
Chris, you should be able to add the JDOM object into the servlet 
context from the servlet -- something like:

this.getServletContext.setAttribute("jdomObject", jdomObject);

Then use a RequestDispatcher to forward to your JSP.

Johnson, Chris wrote:

> Is it possible to (or how would you) attach a JDOM object (if possible)
> as an application attribute in a servlet and then forward to a jsp page
> to process it?
>  
> Currently I'm doing the opposite, I'm starting with a jsp page and then
> doing an import which is calling a servlet that's outputting text/xml.
> I'm then x:parse'ng that and using xslt from there.  But I want to start
> controlling things from the servlet side instead, and pushing the output
> (JDOM currently) to the jsp page(s).
>  
> I don't seem to be finding an answer to this in all of the stuff I've
> read.
>  
> BTW, I've gone the route of using java code in the jsp page using
> scripting elements (<%...%>), but I was doing the looping and formatting
> that way as well and it was REALLY ugly.  But, if I had to use a hybrid
> approach, I will (i.e. using scripting to convert the Element to a
> string for parsing with x:parse or something like that).
>  
> Anyway, hopefully I made some sense.  Any help would be much
> appreciated.
>  
> Thanks,
> Chris
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org