jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james_strac...@yahoo.co.uk>
Subject Re: JDOM taglib
Date Wed, 15 Aug 2001 17:02:43 GMT
Hi Aron

Sorry for the slow response responding to your mail - I've been kinda swamped lately.

A couple of quick questions before I start...
  From: Aron Kramlik 

  I am wondering if there is a custom tag library out there that uses JDOM
  underneath?  Our web application talks to a server that accepts XML
  and returns XML, or rather a JDOM representation of XML.  What I would
  like to achieve is to use custom tags directly on the JDOM Document and
  Element objects that I have already got back via RMI.

Are you sending JDOM objects over RMI? If so I'd highly recommend you send XML as XML text
instead. Java Serialization of XML object models is usually far slower than regular XML text
parsing and writing.

Dennis Sosnoski has done some performance tests which demonstrate this pretty conclusively:-


  Is there something out there that would help me with this?
  Does anyone see any problems with this approach for performance, 
  scalability or any other reasons?

  I am also contemplating creating a JDOM Document/Element in the control
  servlet from the HTTP input parameters that the servlet gets.  An underscore "_"
  naming convention woud be used to indicate a sub-element.  So, on the HTML
  form the following INPUT fields:
   - username=""
   - password=""
   - homeaddress_street=""
   - homeaddress_city="" 
   - homeaddress_state=""
   - homeaddress_postcode=""
   - workaddress_street=""
   - workaddress_city="" 
   - workaddress_state=""
   - workaddress_postcode=""
  Would become a JDOM Document/Element that looks something like:
    <username> </username>
    <password> </password>
    <homeaddress >
      <street> </street>
      <city> </city>
      <state> </state>
      <postcode> </postcode>
      <street> </street>
      <city> </city>
      <state> </state>
      <postcode> </postcode>

Again I'd recommend you pass it to the server as XML text, rather than as an XML object model
over RMI. Its more flexible (the server side can use any XML technology to process it, JAXP,
JDOM, dom4j, DOM, SAX, JAXB, XSLT etc) and its much faster.

  This would then be ready to be passed across to the server via RMI or manipulated as needed
  before doing so.  Has anybody done something like this and have any opinions/arguments
  for or against it?

I think the general idea of turning input parameters into some XML structure to that it can
be processed using XML techniques is a good one. It would be a nice way to validate form input
using XML validation mechansims, such as RelaxNG or XML Schema. Or XPath and XSLT can be used
to process form results etc.

I'd recommend that the tag simply output the text of the XML, then it can be further processed
by other tags and may be parsed into an XML object model or XSLT engine if need be or just
sent, as text to some other servlet or web resource.

A simple tag of the form:-

<foo:parametersToXML seperator="_"/>

would do the trick so the JSP to accomplish the above could look like:-

    <foo:parametersToXML seperator="_"/>

which is pretty cool.

Then using another taglib we could parse this XML and do something with it - e.g. using XTags
we could perform XPath on this...

    <foo:parametersToXML seperator="_"/>

<xtags:forEach select="//city">
    City: <xtags:valueOf select="."/>


View raw message