• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Having a problem with struts-tiles

 
Tong Wang
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am learning tiles and when I try to run my first tiles web app, I got an error:

Path display.welcome does not start with a "/" character

where "display.welcome" is a definition in my tiles-defs.xml. My struts action mapping looks like this:

<action path="/welcome" forward="display.welcome"/>

And I do have the tiles plugin in my struts-config.xml.

Can someone help me figure out what's wrong?

Thanks,
Tong
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add tiles plugin to struts config

 
Tong Wang
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply. I had that part in my struts config, what I really missed is the following line:

<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>

Can someone tell me what this does? Does it handle the mapping between the tiles definitions and the forwards?
 
Chris Boldon
Ranch Hand
Posts: 190
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This processor subclasses the Struts RequestProcessor in order to intercept calls to forward or include. When such calls are done, the Tiles processor checks if the specified URI is a definition name. If true, the definition is retrieved and included. If false, the original URI is included or a forward is performed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic