2010/7/28 Motley, Jeffery <[email protected]>: > This solution requires me to place additional definitions in the xml > file for every page I have, since they all would have some kind of > unique JavaScript. I would then use the extended definition in my custom > page. Is there any way to not define the new JavaScript in the xml > config file and to include it in the custom jsp that uses the master > layout either by including a custom JavaScript file or have custom > JavaScript inline in the custom jsp?
To not define a plethora of definitions, you can use a ViewPreparer, and override an attribute following a rule (if you can find one): http://tiles.apache.org/framework/tutorial/advanced/preparer.html For an inline Javascript, you can use <tiles:insert> as usual with an attribute of "template" type. > For instance, in all of the examples I see the body tag is in the > master_layout.jsp. I want to define the body tag in my custom.jsp that > uses the master layout because I might want to call some custom > JavaScript at body onLoad. I hope this makes sense? In this particular case I think that using unobtrusive Javascript, that modifies onload of <body> element when loaded, is the best approach. With things like jQuery or Prototype it's very easy: http://www.prototypejs.org/api/event/observe Antonio
