In the meanwhile, I'v tried someting else, without success though:

Instead of woring with h:messages (which is buguous, cf earlier post), I worked with a regular label inside the form:
...
<h:outputLabel styleClass="error" value="" id="globalErrorMsg"/>
<h:message for="globalErrorMsg" styleClass="error" showSummary="true" />
...
and coded: (in the same interceptor)

FacesEvent event = new ValueChangeEvent(errComp, "oldValue", "newValue");
event.setPhaseId(javax.faces.event.PhaseId.ANY_PHASE);
errComp.decode(getFacesContext());      // apply values to this comp
getFacesContext().getViewRoot().processUpdates(getFacesContext());

With this I had hoped ("ANY_PHASE" --> at least also the render respons phase) the outputLabel component would show "newValue"
But it didn't!
Someone to give me a hint?
Grrrrrr.

Wolf  (hence the "grrrrr" ;-)

_________


On 10 Aug 2006, at 20:24, Wolf Benz wrote:

Hi,

I have this question:
I am intercepting a JSF Bean 's action method (to apply method-based security) with Spring.

In it I do this (test code, hance the hard coding of a few vars) in Spring's invoke() method of the interceptor:

...
getFacesContext().addMessage("usersForm:errors", new FacesMessage ("Security Error!")); // add msg to comp with clint ID "errors" in form "usersForm"
Iterator it3 = getFacesContext().getMessages("usersForm:errors");
while(it3.hasNext()){ logger.info("This is a msg of errors: " + ((FacesMessage)it3.next()).getSummary());}
                                
UIMessages errComp = (UIMessages)rootview.findComponent ("usersForm:errors");
if(errComp == null)logger.info("errComp is null!");
errComp.decode(getFacesContext());                                              
                // apply values to this comp
getFacesContext().getViewRoot().processUpdates(getFacesContext ()); // force recursive (?) master refresh
...
return null; (to force JSF to stay on teh same page - this works fine. (if I call "return inv.proceed();" it just continues of course))
Observations:
- "This is a msg of errors: " actually prints out the error msg again, in my Eclipse console, so the error msg WAS effectively added to the component.
- "errComp is null" is never printed.
- As the msg wasn't shown in the page, I added the 2nd paragraph, hoping to force an updated rendering this way.

--> What is strange: the actual error message, is NEVER shown.

& In the page ,I have:
...
 <t:messages id="errors" globalOnly="true" styleClass="error" />
 </h:form>
...

Any ideas as to what I'm doing wrong/how to force this component being rendered after all?

Thx guys,
Wolf

Reply via email to