| Author |
Struts tiles help
|
shabarish vai
Ranch Hand
Joined: May 26, 2008
Posts: 79
|
|
hi all
i have a query am using struts tiles which has header,menu,body and footer,
my requirement is if i provide any link in menu.jsp i should be able to display the page in body.jsp.
fro instance in menu.jsp if i provide link like add category then AddCategory.jsp must be loaded and id i gice add Product link then AddProduct.jsp must be loaded in the place where body.jsp is displayed initially.
Base.jsp is
Template.jsp is
Menu.jsp is
if i click on Add Category then AddCategory.jsp be loaded,
|
 |
shabarish vai
Ranch Hand
Joined: May 26, 2008
Posts: 79
|
|
|
hi can anyone please help me in this , as am struck not able to proceed
|
 |
M Turner
Greenhorn
Joined: Dec 16, 2009
Posts: 25
|
|
Hi,
You need to have a unique tiles definition for each page that you want on your navigation. The new tiles definitions will override only the body element I suspect if you want all of the other parts of the page to be the same. Then in your navigation links will point to the tile definition you have created in your tiles.xml.
Good Luck
|
 |
shabarish vai
Ranch Hand
Joined: May 26, 2008
Posts: 79
|
|
when i click on one of the link from menu it should override body.jsp but how do i override the body dynamically as and when i click on the link
please send me if any code or example for the same
|
 |
M Turner
Greenhorn
Joined: Dec 16, 2009
Posts: 25
|
|
What does your tiles.xml page look like? Do you have a definition for AddCategory that extends your base page definition?
Once you have all of your definitions, your struts.xml action mappings will refer to your tiles definitions:
|
 |
shabarish vai
Ranch Hand
Joined: May 26, 2008
Posts: 79
|
|
|
Turner, i have no files by tiles.xml, can i know the reason for tiles.xml and where should i put the code which you have given?
|
 |
M Turner
Greenhorn
Joined: Dec 16, 2009
Posts: 25
|
|
It's also called tiles-def.xml - I don't think the name matters as long as you put the same file name in your web.xml. Here'e the documentation:
http://tiles.apache.org/framework/tutorial/basic/pages.html
There are lots of tutorials online.. G/L
|
 |
 |
|
|
subject: Struts tiles help
|
|
|