Re: JSF Life Cycle / JSF Rendering question / Spring
Hi Dhanji, Thanks for taking the time to reply. I'll reply in between yr posting. From a quick glance you have globalOnly=true in your h:messages and it looks like you're adding a message with a handle userForm:errors (non-global). Try setting globalOnly to false or creating a faces message with a null handle (to make the message global). -- True remark. I had tried this first, but to no avail. (h/ t:messages is buguous) After trying this, I added an ID(id=errors) to the h:messages and tried to add it to the component by means of the ID. (also without success though) For the second problem of using outputLabel with h:message , I don't see any code adding a faces message for component id=globalErrorMsg so likely as not it will not show anything. But I don't think Ive understood what you're trying to do here so this may not be an appropriate answer... -- What I tried there, is not adding a message, yet changing the actual value of the label itself instead of adding a msg to it. Thus (ab-)using the label as a message container... :-) PS: shouldn't it be *growl* =) -- True!! (once agin realizing I'm sitting too much behind computers ;-) Wolf -Original Message- From: Wolf Benz [mailto:[EMAIL PROTECTED] Sent: Friday, 11 August 2006 5:53 AM To: MyFaces Discussion Subject: Re: JSF Life Cycle / JSF Rendering question / Spring 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? Grr. Wolf (hence the gr ;-) _ 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 This correspondence is for the named persons only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis transmission. If you receive this correspondence in error please delete it from your system immediately and notify the sender. You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender except where the sender expressly, and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.
Re: JSF Life Cycle / JSF Rendering question / Spring
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? Grr. Wolf (hence the gr ;-) _ 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
RE: JSF Life Cycle / JSF Rendering question / Spring
Hi Wolf, From a quick glance you have globalOnly=true in your h:messages and it looks like you're adding a message with a handle userForm:errors (non-global). Try setting globalOnly to false or creating a faces message with a null handle (to make the message global). For the second problem of using outputLabel with h:message , I don't see any code adding a faces message for component id=globalErrorMsg so likely as not it will not show anything. But I don't think Ive understood what you're trying to do here so this may not be an appropriate answer... Dhanji. PS: shouldn't it be *growl* =) -Original Message- From: Wolf Benz [mailto:[EMAIL PROTECTED] Sent: Friday, 11 August 2006 5:53 AM To: MyFaces Discussion Subject: Re: JSF Life Cycle / JSF Rendering question / Spring 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? Grr. Wolf (hence the gr ;-) _ 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 This correspondence is for the named persons only. It may contain confidential or privileged information or both. No confidentiality or privilege is waived or lost by any mis transmission. If you receive this correspondence in error please delete it from your system immediately and notify the sender. You must not disclose, copy or relay on any part of this correspondence, if you are not the intended recipient. Any opinions expressed in this message are those of the individual sender except where the sender expressly, and with the authority, states them to be the opinions of the Department of Emergency Services, Queensland.