Thanks, Cedric. I got this to work in the perform method of my Action
class:
ComponentDefinition definition =
DefinitionsUtil.getDefinition(mapping.findForward("success").getPath(),
request,
getServlet().getServletContext());
definition.putAttribute( "title", "Overloaded title" );
DefinitionsUtil.setActionDefinition( request, definition);
Does it make sense to override the Tiles ActionServlet to invoke the
above code to make some dynamic attributes available to all of my
definition views? Or would the Controller class be a better solution?
-- Jim
Cedric Dumoulin <[EMAIL PROTECTED]> writes:
> So your install seem to work perfectly. Sorry for the wrong
> response before, it > is what happen when you do to much things in
> the same time.
>
> It is normal that the componentContext is not found if you access
> directly the > action (with *.do). The context is set when the
> tile is inserted, or when an > action forward to a tile.
>
> It work in the first url, because the action is inserted, so the
> context > created. A workaround is to have another action
> forwarding to the action overloading > parameter. Another
> possibility is to define a definition with appropriate attributes,
> and > set it in jsp context as in (not tested)
>
> ComponentDefinition definition = new ComponentDefinition();
> // initialize definition here. If struts forward also specify a definition,
> attributes defined here will preval
> definition.putAttribute( "attributeName", "aValue" );
> ....
> // Set def to be used by struts forward
> DefinitionsUtil.setActionDefinition( request, definition);
> return (mapping.findForward("success"));
>
> Also check example/tiles/test/TestActionTileAction.java
>
> Hope this help,
>
> Cedric
>
>
> Jim Crossley wrote:
>
> > Cedric Dumoulin <[EMAIL PROTECTED]> writes:
> >
> > > tiles-doc.jar is shipped with Struts1.1 previous than 15 jan, and is
> > > ready to run. So you can try the mentioned url test directly on it,
> > > and it should run. If not, let me know.
> >
> > This runs:
> > http://localhost:8080/tiles-doc/test/testStrutsAction.jsp
> >
> > This does not:
> > http://localhost:8080/tiles-doc/test/testAction.do
> >
> > It doesn't because the call to ComponentContext.getContext(request) in
> > org.apache.struts.example.tiles.test.TestActionTileAction returns
> > null.
> >
> > So I'm still not sure how to overload definition attributes (specified
> > in an XML file) in a Struts action. :-(
> >
> > --
> > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>