Hi
I am still very new to
struts framework, but I already have done some examples and got them working. Because I am still learning, I want to get it done right and one thing that I am not confident about is using tiles. There are several ways in using the tiles, but I want to know what is the best and most general way of using them.
So what I want:
I have a simple page layout and it consists of two things: navigation menu - just links that stays the same and a content area which needs to be updated after every action.
For example it is a simple e-shop web-application on a very early stage. So the navigation has links to: products, serach product and contact and according to content area, it displays: list of products, serach form and contact information.
So how I would do it:
Create a main layout for the page and then for each new content, I extend a main layout and add information about the content area to tiles-defs.xml:
So then create the
jsp files to the "/content" directory, where search-form.jsp and contact.jsp are pages with static information and products.jsp would get its data from database for example.
So for displaying products, I make action class and add action mapping to struts-config.xml:
And in web.xml there is nothing new:
So the links in navigation.jsp would be like so:
I don't deal with product searching right now ...
OK, so that would be it. Would that be a reasonable solution?
And here are my doubts:
1. It is very simpel layout, where only content area changes. Do I really have to make a new layout definition to tiles-defs.xml and make global forward to struts-config.xml, when ever there is new action on the web-app or is there some kind of shortcut?
2. To use tiles, all my links on the navigation and perhaps in content area allso have to be processed through struts-config.xml by forwarding it to proper tiles definition. In other words - all the links must be *.do - so I can apply a layout definiton to it? That is it for now.
[ April 15, 2006: Message edited by: Juhan Voolaid ]
[ April 17, 2006: Message edited by: Juhan Voolaid ]