JSF 1.2_04
Sun Java System Application Server 9.0_01
I don't understand why I can't use a FacesMessage within a catch
statement in a Backing Bean?
For example, in an event:
public void doFreeFormSearch(ActionEvent event) {
FacesContext facesContext = FacesContext.getCurrentInstance();
FacesMessage message = new FacesMessage();
...
try {
...
} catch (MyException e) {
message.setSeverity(FacesMessage.SEVERITY_ERROR);
message.setSummary("No results found.");
facesContext.addMessage(null, message);
facesContext.renderResponse();
logger.error("My Exception:", e);
On my JSP page, I have:
<h:messages/>
When I catch MyException, the error message *is* written to my
server.log file, but the h:messages component is never rendered?
I step through this in Netbeans 5.5 and the FacesMessage is added to the
FacesContext.
How do I use FacesMessage correctly with a try/catch statement?
(I've fought this for over a day now.)
Thanks,
--Todd
-----------------------------------------
NOTICE: This email message is for the sole use of the intended
recipient(s) and may contain confidential and privileged
information. Any unauthorized use, disclosure or distribution is
prohibited. If you are not the intended recipient, please contact
the sender by reply email and destroy all copies of the original
message.