Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Tiles template definition + Struts Action

 
Oliver Ng
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I did a search and didn't find any information so, here is my quesiton:

I'm using a tiles definition xml, and I would like to have a header be dynamically picked based on what information is taken from a database.

Now I realize, i could, technically do whatever processing I need to in a JSP, but I'd like to use a Struts Action to determine what header file to include. My current XML is this:


now I was wondering if it's acceptable to do this in the "header" value:


is this possible? and how would I be able to pass a different value URL to the header "put" definition?

thanks for any or all help
Cheers,
Oliver
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
by my understanding, tiles only understands a few extensions and will complain if it sees anything else.

I recommend having header.jsp be dynamic enough to handle what you need.
 
Oliver Ng
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, i'm getting close but not quite there yet.

I'm using

to create an action that puts the needed attributes into the tiles:insert html tag, but i've run into an issue that i'm baffled with.

I can't seem to get the insert tag to read the attribute given to it by my controller action, instead it seem to read the header value right away.

maybe what i'm doing is wrong but somehow i feel like i'm on kind of the right track? anybody?
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I believe tiles are processed before anything else, preventing you from inserting a dynamic value there.
 
Oliver Ng
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, i've finally managed a way to do it



this actually seems to work as it overwrites the HEADER attribute in the definition, based on what my action wants to do.

I've run into another problem though. Is there a way to forward to an external URL? when i use

it gives forwards the address as http://localhost/MYAPPNAME/http://lcaolhost/ssi/header.jsp

how can i get around this automatic appending of my application root path?

Thanks for your input so far.
[ June 28, 2004: Message edited by: Oliver Ng ]
 
Miguel Flecha
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm having the same problem, but I don't know how to generate de dynamic jsp from the action... Do you know how to do that?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic