• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Struts tiles help

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi can anyone please help me in this , as am struck not able to proceed
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
A teeny tiny vulgar attempt to get you to buy our stuff
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic