Closed GoogleCodeExporter closed 9 years ago
Hmm... we looked through the code looking to be affected, but couldn't spot the
issue.
Could you provide a small project (maven?) to reproduce the issue?
thanks,
dominik
Original comment by dominik....@gmail.com
on 18 Nov 2010 at 9:34
Multiple URL actions are definitively possible. If you are using the annotation
style configuration you can do this by using the @URLActions annotation like
this:
@URLActions(actions = {
@URLAction(mappingId = "myMapping", phaseId = PhaseId.RENDER_RESPONSE),
@URLAction(mappingId = "otherMapping", phaseId = PhaseId.INVOKE_APPLICATION)
})
public void myAction() {
// some code
}
But it seems like you are trying to add the second action programmatically,
correct?
Where do you call myMapping.addAction(myOtherAction)? From a
ConfigurationPostProcessor?
Original comment by chkalt
on 19 Nov 2010 at 6:26
But it seems like you are trying to add the second action programmatically,
correct?
Yes it is correct.
Where do you call myMapping.addAction(myOtherAction)? From a
ConfigurationPostProcessor?
Yes.
Original comment by bal...@gmail.com
on 19 Nov 2010 at 4:23
I was not able to reproduce this issue. The following
ConfigurationPostProcessor works as expected:
public class AddActionsConfigPostProcessor implements ConfigurationPostProcessor
{
@Override
public PrettyConfig processConfiguration(ServletContext context, PrettyConfig config)
{
for(UrlMapping mapping : config.getMappings())
{
mapping.addAction( new UrlAction("#{welcomeBean.secondAction}") );
}
return config;
}
}
However it is important to understand that this code appends the new action to
the list of existing actions. This means that the new action will be executed
after all other actions. If one of the existing actions returns a result (not
null or void), PrettyFaces will call the NavigationHandler to process this
outcome. In this case the remaining actions won't be executed and a navigation
will occur.
Perhaps this is the cause of your problem? In this case you could try to insert
the action before all others by using something like this:
mapping.getActions().add(0, new UrlAction("#{welcomeBean.secondAction}") );
Original comment by chkalt
on 20 Nov 2010 at 7:06
It works perfectly! Thanks. Next time I will post on the forum instead of
opening issues.
Thanks a lot!
J.
Original comment by bal...@gmail.com
on 20 Nov 2010 at 10:58
Original comment by chkalt
on 20 Nov 2010 at 11:00
Original issue reported on code.google.com by
bal...@gmail.com
on 18 Nov 2010 at 6:19