The moose likes JSF and the fly likes insert text after executing action Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "insert text after executing action" Watch "insert text after executing action" New topic

insert text after executing action

Jukka Nevalainen

Joined: Dec 14, 2009
Posts: 9
Hi all

I have a template which looks like that:

The 'msgs' are defined in every page like that:

The error handler should return all errors that have to be displayed. Errors are added to the ErrorHandler while processing the action, which obviously happens after the call to ErrorHandler.errors. So, what happens? First, all errors are displayed (there are none). Secondly, the action is being processed and perhaps some erros added. But they are only displayed in the next request/response. The problem is, that the call to ErrorHandler.errors is made before the action is being processed.

How could we change that order?

I'd appreciate if anybody could give a hint.

Sridhar Santhanakrishnan
Ranch Hand

Joined: Mar 20, 2007
Posts: 317
Are you using some JSF extensions? Like RichFaces?
Jukka Nevalainen

Joined: Dec 14, 2009
Posts: 9
Sridhar Santhanakrishnan wrote:Are you using some JSF extensions? Like RichFaces?

No, nothing
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

There is no "ErrorHandler.errors" method here. What you are doing is coding an EL expression that references the "errors" property of a bean named "ErrorHandler". Which is a bad choice for a bean name, because you're using the Classname capitalization convention on an instance of a class.

However, like I said, there's no "errors" method, just calls to getErrors() and setErrors(). Or, since this is an output-only component, just getErrors(). The actual value of the "errors" property has be be set somewhere else, such as in an action processor.

As a side note, you're using the "escape" option which means you're apparently planning to output raw HTML. That's not something I recommend as a general rule. It muddies the Model and View boundaries. In fact, ff you look at the JSF standard "messages" tag, you'll notice there is no "escape" attribute there. They provide basic formatting services (table or list view) and leave the rest up to CSS.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: insert text after executing action
It's not a secret anymore!