You have to say

it.remove();

instead of

context.getMessages().remove();

regards,

Martin

On 12/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> An second question:
>
> How can I remove the messages?
> I tried:
>
> Iterator it = context.getMessages();
>         while(it.hasNext())
>                 {
>                         context.getMessages().remove();
>                 }
>
> But I get an error stack.
>
> javax.faces.el.EvaluationException: Exception while invoking expression 
> #{linker.setEndDate}
>         at 
> org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
>         at javax.faces.component.UIInput.broadcast(UIInput.java:200)
>         at 
> javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
>         at 
> javax.faces.component.UIViewRoot.processValidators(UIViewRoot.java:143)
>         at 
> org.apache.myfaces.lifecycle.LifecycleImpl.processValidations(LifecycleImpl.java:260)
>         at 
> org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:77)
>         at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at 
> org.apache.myfaces.component.html.util.ExtensionsFilter.doFilter(ExtensionsFilter.java:123)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at 
> com.magnasteyr.msaaa.client.web.SecurityFilter.doFilter(SecurityFilter.java:139)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at 
> com.magnasteyr.msaaa.client.web.PortalRedirectFilter.doFilter(PortalRedirectFilter.java:105)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
>         at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>         at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
>         at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
>         at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
>         at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
>         at 
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
>         at 
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
>         at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
>         at 
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
>         at 
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
>         at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
>         at java.lang.Thread.run(Thread.java:534)
> Caused by: java.lang.IllegalStateException
>         at java.util.AbstractList$Itr.remove(AbstractList.java:432)
>         at com.magnasteyr.editool.Linker.setEndDate(Linker.java:507)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
>         ... 29 more
>
> -----Ursprüngliche Nachricht-----
> Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
> Gesendet: Montag, 5. Dezember 2005 11:57
> An: MyFaces Discussion
> Betreff: Re: Problems with ValueChangeListener and FacesMessages
>
>
> Short answer: no way ;)
>
> A workaround is coming to my mind: iterate through your faces-messages
> in the second valueChangeListener and remove them?
>
> regards,
>
> Martin
>
> On 12/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > I have one component on my page, where the immediate Attribute is set to 
> > true. And for this component the message is shown when the 
> > ValueChangeListener from my Selectbox is executed. For others no message is 
> > shown!
> > The Problem is, that I need this immediate Attribute to set to true, 
> > because on this component (it's a InputTextBox) I also have a 
> > ValueChangeListener.
> >
> > So is there a way to skip the validation for this one component (for the 
> > InputTextBox) during the first ValueChangeListener method?
> >
> > Regards,
> > Andy
> >
> > -----Ursprüngliche Nachricht-----
> > Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
> > Gesendet: Montag, 5. Dezember 2005 10:57
> > An: MyFaces Discussion
> > Betreff: Re: Problems with ValueChangeListener and FacesMessages
> >
> >
> > It's only executed for the components which have immediate set to true
> > - if you call facesContext.renderResponse in your valueChangeListener,
> > it won't be executed for the others.
> >
> > regards,
> >
> > Martin
> >
> > On 12/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > The only thing I want to do is:
> > >
> > > Set some values from the backing bean into some inputtext tags (and this 
> > > is done in the valuechangelistener method)
> > >
> > > I didn't know, that the conversion and validation phase is executed...
> > > Is there a way to skip this?
> > >
> > > Regards,
> > > Andy
> > >
> > > -----Ursprüngliche Nachricht-----
> > > Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
> > > Gesendet: Montag, 5. Dezember 2005 10:23
> > > An: MyFaces Discussion
> > > Betreff: Re: Problems with ValueChangeListener and FacesMessages
> > >
> > >
> > > so in fact you want to get rid of the submitted values, and for this
> > > you recreate the whole tree?
> > >
> > > maybe you could use component binding on those inputTexts that should
> > > loose their submitted value and reset the submitted value yourself for
> > > them?
> > >
> > > In any case I don't see why your approach shouldn't work. Have you
> > > checked if the conversion and validation phase is executed for the
> > > other components except your immediate components?
> > >
> > > You know that for the immediate components, the conversion and
> > > validation _is_ executed anyways, so you would see those messages in
> > > any case?
> > >
> > > regards,
> > >
> > > Martin
> > >
> > > On 12/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > No it's the same page, but in the ValueChangeListener some values for 
> > > > inputtext Tags are set and I have to refresh the page to display them.
> > > > This works fine, but is there another method to refresh the page?
> > > >
> > > > Regards,
> > > > Andy
> > > >
> > > >
> > > > -----Ursprüngliche Nachricht-----
> > > > Von: Martin Marinschek [mailto:[EMAIL PROTECTED]
> > > > Gesendet: Montag, 5. Dezember 2005 10:14
> > > > An: MyFaces Discussion
> > > > Betreff: Re: Problems with ValueChangeListener and FacesMessages
> > > >
> > > >
> > > > Hmmm...
> > > >
> > > > Let me try to understand what you are doing here - you want to head
> > > > off to a new page, right?
> > > >
> > > > regards,
> > > >
> > > > Martin
> > > >
> > > > On 12/5/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > >
> > > > > Hi All!
> > > > >
> > > > > I have problems with a ValueChangeListener and FacesMessages.
> > > > > In my JSP Site there is a Selectbox with a ValueChangeListener. 
> > > > > Although I
> > > > > have set the immediate=True Attribute at this Selectbox, messages are 
> > > > > shown
> > > > > after the ValueChangeListener has been executed..
> > > > >
> > > > > Can you tell me why this happens??Is it perhaps the 
> > > > > Context.setViewRoot?
> > > > >
> > > > > Here is my code:(JSP)
> > > > >
> > > > > <h:selectOneMenu binding="#{newPartnerDto.SMstatus}"
> > > > > id="newPartnerstatus" styleClass="mustfield"
> > > > > value="#{newPartnerDto.statusId}" required="true"
> > > > > valueChangeListener="#{linker.setEndDate}"
> > > > > onchange="submit()">
> > > > >         <f:selectItems value="#{queryHelper.status}" />
> > > > > </h:selectOneMenu>
> > > > >
> > > > >
> > > > > Here is my code:(ValueChangeListener Method:)
> > > > >
> > > > > public void setEndDate(ValueChangeEvent event) {
> > > > >                 editDto = (EditDto) 
> > > > > FacesUtil.getManagedBean("editDto");
> > > > >                 sessionDto = (SessionDto)
> > > > > FacesUtil.getManagedBean("sessionDto");
> > > > >                 newPartnerDto = (NewPartnerDto) FacesUtil
> > > > >
> > > > > .getManagedBean("newPartnerDto");
> > > > >
> > > > >                 if (((Long) event.getNewValue()).compareTo(new 
> > > > > Long(1)) == 0
> > > > >                                 && editDto.getEndDate() == null
> > > > >                                 &&
> > > > > event.getComponent().getId().equalsIgnoreCase("status")) {
> > > > >                         editDto.setEndDate(new Date());
> > > > >                         
> > > > > editDto.setEndPerson(sessionDto.getUserName());
> > > > >
> > > > >                         String viewId = "/edit.jsp";
> > > > >                         FacesContext context =
> > > > > FacesContext.getCurrentInstance();
> > > > >                         UIViewRoot view =
> > > > > context.getApplication().getViewHandler()
> > > > >                                         .createView(context, viewId);
> > > > >
> > > > >                         view.setViewId(viewId);
> > > > >                         context.setViewRoot(view);
> > > > >                         context.renderResponse();
> > > > >                 }
> > > > >
> > > > > }
> > > > >
> > > > > THX for help,
> > > > > Regards
> > > > > Andy
> > > > > ______________________________________________________________________
> > > > > This email and any files transmitted with it are confidential and 
> > > > > intended
> > > > > solely for the use of the individual or entity to whom they are 
> > > > > addressed.
> > > > > If you have received this email in error please notify your system 
> > > > > manager.
> > > > > This footnote also confirms that this email message has been swept 
> > > > > for the
> > > > > presence of computer viruses.
> > > > > ______________________________________________________________________
> > > > >
> > > >
> > > >
> > > > --
> > > >
> > > > http://www.irian.at
> > > >
> > > > Your JSF powerhouse -
> > > > JSF Consulting, Development and
> > > > Courses in English and German
> > > >
> > > > Professional Support for Apache MyFaces
> > > >
> > > >
> > > > ______________________________________________________________________
> > > >
> > > > This email and any files transmitted with it are confidential and
> > > > intended solely for the use of the individual or entity to whom they
> > > > are addressed. If you have received this email in error please notify
> > > > your system manager.
> > > >
> > > > This footnote also confirms that this email message has been swept
> > > > for the presence of computer viruses.
> > > > ______________________________________________________________________
> > > >
> > >
> > >
> > > --
> > >
> > > http://www.irian.at
> > >
> > > Your JSF powerhouse -
> > > JSF Consulting, Development and
> > > Courses in English and German
> > >
> > > Professional Support for Apache MyFaces
> > >
> > >
> > > ______________________________________________________________________
> > >
> > > This email and any files transmitted with it are confidential and
> > > intended solely for the use of the individual or entity to whom they
> > > are addressed. If you have received this email in error please notify
> > > your system manager.
> > >
> > > This footnote also confirms that this email message has been swept
> > > for the presence of computer viruses.
> > > ______________________________________________________________________
> > >
> >
> >
> > --
> >
> > http://www.irian.at
> >
> > Your JSF powerhouse -
> > JSF Consulting, Development and
> > Courses in English and German
> >
> > Professional Support for Apache MyFaces
> >
> >
> > ______________________________________________________________________
> >
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > your system manager.
> >
> > This footnote also confirms that this email message has been swept
> > for the presence of computer viruses.
> > ______________________________________________________________________
> >
>
>
> --
>
> http://www.irian.at
>
> Your JSF powerhouse -
> JSF Consulting, Development and
> Courses in English and German
>
> Professional Support for Apache MyFaces
>
>
> ______________________________________________________________________
>
> This email and any files transmitted with it are confidential and
> intended solely for the use of the individual or entity to whom they
> are addressed. If you have received this email in error please notify
> your system manager.
>
> This footnote also confirms that this email message has been swept
> for the presence of computer viruses.
> ______________________________________________________________________
>


--

http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Reply via email to