File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes Tiles question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Tiles question " Watch "Tiles question " New topic
Author

Tiles question

Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
hi, the below is part of tiles definition on tile-defs.xml



now, because header page is actually menu section , and the menu is customize, means we allow user customize the menu , and finally assign to specify person based on the customized menu ,

if i already define definition in tiles as mentioned above, how to i override this definition by replace different header ?

i know it should be put the extends as below :



so, is that means i need to edit the tile-def.xml ? any other way to solve this problem ?

thank you !
[ February 23, 2005: Message edited by: Alvin chew ]
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
Is it a problem to edit tiles-def.xml in your case ? You can have have your definition for "manager layout" in another file, provided you declare it in your struts-config.xml, the same way you declare tiles-defs.xml.

If my guess is right you could enter:



Originally posted by Alvin chew:
hi, the below is part of tiles definition on tile-defs.xml



now, because header page is actually menu section , and the menu is customize, means we allow user customize the menu , and finally assign to specify person based on the customized menu ,

if i already define definition in tiles as mentioned above, how to i override this definition by replace different header ?

i know it should be put the extends as below :



so, is that means i need to edit the tile-def.xml ? any other way to solve this problem ?

thank you !

[ February 23, 2005: Message edited by: Alvin chew ]
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
thank you ken for reply , my problem actually simple ..if i make a web menu component which allow each user can have their own menu(something like tree menu), and the different menu will locate into header.jsp, so my component suppose to have many different header.jsp for each user.

now, if i predefine in tile-def.xml, it would be fine, because we can use some concept like inheritance to write it into tile-def.xml ,

my problem is assume we have one default set of definition in tile-def.xml, now if new definition need to be add into tile-def.xml, what i suppose to do ? do i need to write it into tile-def.xml or any other way to make new definition inherit the predefine definition ? if yes, can i simply using xml parser to write it to tile-def.xml ? so we need to restart the tomcat everytime?
Ken Loh
Ranch Hand

Joined: Feb 16, 2005
Posts: 190
I think I must first find out if I understand you correctly.

Are you saying that your menu can be personalized by your user ? And it is rendered dynamically according to data from a datasource ?

Personally, I think tiles provides layouts where component tiles can be dynamically rendered. If I were in your case, I would generalize the possible forms the menu could manifest itself, and then create tiles definition for each of the generalized menu. I would then create an Action subclass that will forward to the right generalized menu accordingly.

Then, I would enter decision making logics in the JSPs that are component tiles within each definition.

This would be what I would do in your position.

Originally posted by Alvin chew:
thank you ken for reply , my problem actually simple ..if i make a web menu component which allow each user can have their own menu(something like tree menu), and the different menu will locate into header.jsp, so my component suppose to have many different header.jsp for each user.

now, if i predefine in tile-def.xml, it would be fine, because we can use some concept like inheritance to write it into tile-def.xml ,

my problem is assume we have one default set of definition in tile-def.xml, now if new definition need to be add into tile-def.xml, what i suppose to do ? do i need to write it into tile-def.xml or any other way to make new definition inherit the predefine definition ? if yes, can i simply using xml parser to write it to tile-def.xml ? so we need to restart the tomcat everytime?
Alvin chew
Ranch Hand

Joined: Jan 08, 2004
Posts: 834
i see ...thanks ken ...your suggestion is good ...i will think over it
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tiles question
 
Similar Threads
Struts Tiles Inheritance problem
Nest tiles don't work :(
Tiles. Decorator. What is the right way?
Struts Tiles and URL
Building Exception page using tiles