tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kris Schneider <k...@dotech.com>
Subject Re: Question Regarding JSTL <x:parse> tag
Date Fri, 16 Jan 2004 16:18:15 GMT
How 'bout creating a utility tag that just converts the DOM document 
into JDOM?

<x:parse varDom="domDoc" ...> <%-- leave domDoc in page scope --%>
   ..
</x:parse>
<myX:dom2jdom var="jdomDoc" dom="domDoc" scope="session"/>

Isn't the Java code to do the "conversion" something like:

org.jdom.Document jdomDoc = new DOMBuilder().build(domDoc);

Or create a bean instead of a tag to do the conversion...

Michael Duffy wrote:

> RTFM - I need "scopeDom".  Thanks, Kris. - MOD
> 
> 
> --- Michael Duffy <duffymo@yahoo.com> wrote:
> 
>>Hi Kris,
>>
>>When I changed that attribute from var to varDom, I
>>got a jsp.error.tlv.invalid.page exception: 
>>
>>"Illegal scope attribute without var in "x:parse"
>>tag"
>>
>>Does using the scope attribute preclude using the
>>varDom?  Please advise. - MOD
>>
>>
>>--- Michael Duffy <duffymo@yahoo.com> wrote:
>>
>>>Thank you, Kris.
>>>
>>>Personally I like to use the JDOM library by Jason
>>>Hunter and Brett McLaughlin, but I didn't think
>>>they'd
>>>be doing that for JSTL.  No jdom.jar in the distro
>>>that I can see.
>>>
>>>Thank you very much for the insight.  I hope I can
>>>take it from here.  Sincerely, MOD
>>>
>>>--- Kris Schneider <kris@dotech.com> wrote:
>>>
>>>>You can use:
>>>>
>>>><x:parse varDom="doc" ...
>>>>
>>>>To force "doc" to be of type
>>
>>org.w3c.dom.Document.
>>
>>>>Otherwise, if you use 
>>>>the "var" attribute, the type is implementation
>>>>dependent. Of course, a 
>>>>given implementation may happen to also choose
>>
>>to
>>
>>>>use a DOM document, 
>>>>there just aren't any guarantees.
>>>>
>>>>Michael Duffy wrote:
>>>>
>>>>>I answered one of my questions: adding the
>>>>
>>>><x:parse
>>>>
>>>>>scope="session"/> attribute puts the parsed
>>
>>DOM
>>
>>>>into
>>>>
>>>>>session scope.  
>>>>>
>>>>>If I can verify that the classes are
>>
>>org.w3c.dom
>>
>>>>I'm
>>>>
>>>>>all set. - MOD
>>>>>
>>>>>
>>>>>--- Michael Duffy <duffymo@yahoo.com> wrote:
>>>>>
>>>>>
>>>>>>I've got a fundamental question regarding the
>>>
>>>XML
>>>
>>>>>>tags
>>>>>>in JSTL.
>>>>>>
>>>>>>Which DOM scheme are they using?  The classes
>>
>>in
>>
>>>>the
>>>>
>>>>>>org.w3c.dom package?
>>>>>>
>>>>>>I'm asking because I've got an application
>>
>>that
>>
>>>>has
>>>>
>>>>>>a
>>>>>>front controller servlet and a JSP response
>>>
>>>page. 
>>>
>>>>>>The
>>>>>>servlet does a query, gets an XML stream, puts
>>>
>>>it
>>>
>>>>>>into
>>>>>>session scope, and sends down the response
>>
>>JSP.
>>
>>>>>>The response JSP takes the XML stream out of
>>>>
>>>>session
>>>>
>>>>>>scope and uses the <x:parse> tag into its DOM
>>>
>>>tree
>>>
>>>>>>and
>>>>>>iterates through to display values using the
>>>>>><x:forEach> tag.
>>>>>>
>>>>>>I'd like to put the parsed DOM tree back into
>>>>>>session
>>>>>>so it can be re-used by the front controller
>>>>
>>>>servlet
>>>>
>>>>>>on the next request.  I'm assuming that I need
>>>
>>>to
>>>
>>>>>>put
>>>>>>the DOM var into session scope.
>>>>>>
>>>>>>So here are my questions: 
>>>>>>
>>>>>>(1) How do I put the parsed DOM var into
>>
>>session
>>
>>>>>>scope
>>>>>>for reuse by the servlet?
>>>>>>(2) Am I correct to assume that the servlet
>>
>>will
>>
>>>>use
>>>>
>>>>>>the org.w3c.dom classes to walk the tree once
>>
>>it
>>
>>>>has
>>>>
>>>>>>it?  
>>>>>>
>>>>>>Thanks very much - MOD

-- 
Kris Schneider <mailto:kris@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


Mime
View raw message