wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts tiles help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts tiles help" Watch "Struts tiles help" New topic
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
 
Don't get me started about those stupid light bulbs.
 
subject: Struts tiles help
 
Similar Threads
Page is displayed blank for Login Application
Tiles Error during page access
Problem while running a project using tiles in netbeans
Struts Tiles Error
tabbedpanel not working within tiles page in struts2.1.6