Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts Tiles Question

 
Nikes Shah
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I am using Struts Tiles in my project.
Project has Header,Menu(Left Navigation containing hyperlinks),and body.

I want display particular JSP page when user clicks on navigation hyperlinks. means only Body should be changed .

Please give information regarding this problem.

Also whether we have to use ForwardAction or separate Action classes for each hyperlinks ?

Thanks
 
Dom Lassy
Ranch Hand
Posts: 181
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use frames, iframes, or even ajax to load only the body part of the page.

If you don't need to do any business logic to load a page when a hyperlink is clicked you can just use a ForwardAction. Otherwise, you should use an ordinary action class.
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Each tile is its own JSP.

1.) Each link can be its own action, forwarding to its own JSP.

2.) Each link can be a link to a dispatch action with a unique argument to display particular content on a JSP that is forwarded to.

Personally I usually do the second. I create a dynamic content link, which I pass a variable. I then have the action query the database to inject specific content into a JSP, or pull a whole JSP and push it back through the response. That way I can edit the content without redeployment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic