Quoting Tin Pham <[EMAIL PROTECTED]>: > Hi, > > I am wondering if anybody here has mulled over the idea of using XML and XSL > with Tiles. > > Right now I have a great application that makes use of Struts 1.1 with a > role based layout using Tiles. It uses the common layout we see everywhere, > header, dynamic menu, footer and of course body. > > I started thinking that it would be nice to put all the content of the body > tile into an XML file. Just the content though. Including forms and buttons > might not be a good idea at this stage. Simpler would be better as my team > is still learning to be proficient with Struts. > > Googled of course and did not find much. > > The two approaches I am considering are, > > 1) > Change the reference in the tile definition of body=myContent.jsp to a kind > of composition servlet which recieves as paramaters, the xml and xslt file > to output as html (with this approach I would have to include the forms and > buttons). >
This is certainly a feasible approach. If you are running in a Servlet 2.4 (i.e. J2EE 1.4 or Tomcat 5) environment, you also have an additional choice -- in Servlet 2.4 you can specify that filters get invoked on RequestDispatcher.include calls (which is what Tiles does under the covers). Therefore, you can create a (servlet or JSP based) Tile whose reference URL points at an XML-based resource, and then (based on URL-specific filter mappings) apply an XSL transformation in the filter that is appropriate for this particular tile. > 2) > Make a reference to my xml and xslt server side using a custom tag in the > jsp page. > This is definitely a feasible solution. But don't bother trying to create such tags yourself -- there are robust capabilities for this available in the JSP Standard Tag Library (JSTL). An open source implementation of JSTL is available in the "standard" tag library of the Jakarta Taglibs project: http://jakarta.apache.org/taglibs/ > 3) > Figure out a way to render this client side relying on the browser. In an intranet environment where you control the client browser software, this can be a practical approach. For an Internet-based app, have fun with the customer support calls :-). 4) There are some third party Struts add-ons available that address the notion of using XML and XSLT technologies alongside Struts -- check the resource pages for links. > > > Any thoughts or links to resources would be greatly appreciated. > > Craig McClanahan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]