I came to know that if we have model(or data to be displayed in page) encapuslted in XML file , We can display page using XSL files. Advatages -- Your middle tier can be nething J2EE/.NET (Flexibilty) -- You can change presentation tier with more ease. I have few questions regarding this. -- In compared to above mentioned approach is JSP obsolete? -- What's Java support for above approach? -- Any tools in market that generate XSL fiels required from HTML screens? (Generally we do protoype in HTML pages) Thanks Manohar
Regarding two points you mentioned as drawbacks, Slowness -- I agree with this point. Tag Usage -- If page is specifically meant for presentation , IMHO there should not be any complex logic. The tool u menationed Struts CX , Is this useful for generating XSL files from pure HTML pages?
I can understand what Amin said about complex logic. I had problem when I created a tag with XSL for displaying list of months and years. It's quite annoying with XSLT.. for example how can you display year 1900-2000 into listbox. since xslt doesn't have iteration.. except you put this number into source XML ? a lot of other examples especially the variable is only bound one time and cannot be changed, so i have to repeat a lot of logic.
You are right about caching, but caching only works for static page. For example there is one page to display the user information stored in DB. You cannot cache this, because it's different from one user to another. I agree to use xslt as tag for simple / presentation logic only. Even like this I still have problem. For instance to fill one ListBox - List of years - with year 1900 - current year. I think this logic should be placed into taglib - not in other place. So tell me how XSL do it without taking this list of year from XML. I trick it by using Recursive - like PROLOG does... but it's not convienence.
Not quite. I don't cache the generated HTML, but the precompiled XSL. This can then be reused to generate new HTML from different XML (as long as that XML confirms to the DTD the XSL expects of course).
Hi folks, Thanks for ur replies. I have one more query regarding XML+XSL Presentation tier. I worked so far with JSP based presentation tiers. When I need to submit data using JSP i use JSP:setProperty '*' approach... How one can handle using XML+XSLT approach? Like If I want to update status of each order displayed in table (n rows- n orders - n statuses) , Is there any better way of doing thisd thing in XML+XSL approach rather than parsing request params in server? TIA Manohar
jsp:setProperty effectively does just that, it parses the request parameters to the fields of the bean. You could write a similar mechanism yourself and use that as part of your framework, passing in an HttpServletRequest and an Object and classname, then using reflection to match method names to request parameter names (which is probably what the JSP engine does under the hood too).
I suggest huckleberry pie. But the only thing on the gluten free menu is this tiny ad: