aspose file tools*
The moose likes Struts and the fly likes Struts xml with and xslt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts xml with and xslt" Watch "Struts xml with and xslt" New topic
Author

Struts xml with and xslt

Vishnu Murthy
Ranch Hand

Joined: Jan 04, 2001
Posts: 56
Hi All,
I am woking on Struts with xml and xslt on WebSphere Studio Application developer edition v 5.1. I would like to know as where we have to place our xml and xsl file and our result beans and how to map both xml and xsl.

Thanks
-Vishnu
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Vishnu,
I moving your post to struts forum, folks there may help you.
Struts
Cheers
Balaji


Spritle Software Blogs
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
A couple of questions:
1) What XML file? Are you talking about just some custom XML file you need to transform with XSLT? If so, Struts doesn't have anything to say about where you place your files.
2) What is a "result bean" and how is it related to the XML and XSL files?
3) What do you mean by "mapping both XML and XSL"?


Author of Test Driven (2007) and Effective Unit Testing (2013) [Blog] [HowToAskQuestionsOnJavaRanch]
Vishnu Murthy
Ranch Hand

Joined: Jan 04, 2001
Posts: 56
Hi Lasse,
I have read an article on www.javaworld.com/javaworld/jw-02-2002/jw-0201-strutsxslt.html the article says using xml/xslt with struts is called Model2x architecture this is extension to MVC. In this with struts we can use xslt as our view instead of jsp.

Result bean nothing but a model through which we are going to create XML document, on whcih we apply XSLT to get html, xml, cvs output.

and one more article on struts and xml is
http://www.sys-con.com/xml/articleprint.cfm?id=612.
if you please see this there he gave the implementation with example with some code snippets. and hes says that "The names of the XML document and XSL stylesheet are contained within an externalized property resource bundle (named ApplicationResources.properties)". To render some output for view we need to apply xslt on xml, so my question is where we need to specify the mapping between the xml and xsl. I think there should be some file which tells about for a particular xml this is the xsl.

-Thank you
Vishnu
Lasse Koskela
author
Sheriff

Joined: Jan 23, 2002
Posts: 11962
    
    5
The article seems to imply hardcoding properties like "page.frontpage.xsl=transformation.xsl" into ApplicationResources.properties. Having a dedicated configuration file for the transformations is certainly an option, recommended even.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts xml with and xslt