You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by PATRICIA GUEDES <gu...@gmail.com> on 2005/10/27 15:42:21 UTC

Listener Method is called too many times

Hi, everyone!!

Anyone knows why my listener method (remessaBean.delEmbque) is called
so many times?
It seems the listener is called one time for each line of my table. Is
there anything I can do to stop this and call just one time?

<x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
                cellpadding="0" cellspacing="1"
rowClasses="inputFields" headerClass="fields">
       <x:column>
           <f:facet name="header">
               <h:outputText value="Excluir" styleClass="forms"/>
           </f:facet>
           <h:commandButton actionListener="#{remessaBean.delEmbque}"
style="cursor:hand;vertical-align:middle;"
image="/eServices/eservices/images/trash.gif" />
       </x:column>
   </x:dataTable>


public void delEmbque(ActionEvent e) {

          FacesContext context = FacesContext.getCurrentInstance();
          Map map = context.getExternalContext().getRequestParameterMap();
          int index = Integer.parseInt((String) map.get("rowIndex"));

          ArrayList currentValues = (ArrayList)
valuesEmbqueModel.getWrappedData();
          currentValues.remove(index);

          valuesEmbqueModel.setWrappedData(currentValues);

 }

Thanks.
Guedes

Re: Listener Method is called too many times

Posted by Mathias Brökelmann <mb...@googlemail.com>.
yes I use ExtensionsFilter. What is the workaround?

2005/10/28, PATRICIA GUEDES <gu...@gmail.com>:
> Are you using org.apache.myfaces.component.html.util.ExtensionsFilter?
> I am using a workaround for tiles with JSF, because the tiles of
> myfaces doesn't work in OC4J.
>
> Thanks for your reply.
> Guedes
>
> On 10/27/05, Mathias Brökelmann <mb...@googlemail.com> wrote:
> > where do you use your onclick event? I´ve tested your sample and it
> > works. The action listener is only called once for the clicked command
> > button
> >
> > 2005/10/27, PATRICIA GUEDES <gu...@gmail.com>:
> > > Hi again..
> > >
> > > I don't know if helps, but I am using
> > > org.apache.myfaces.component.html.util.ExtensionsFilter in my web.xml.
> > > Another thing that I forgot to tell is that my listener method is
> > > called twice for line of my dataTable. I read somewhere that is my
> > > onclick event in and out.
> > >
> > > Please someone help me. I am testing JSF as a pilot to choose between
> > > JSF and Struts in a new Project, but I am worried about all these
> > > problems. I am stuck for two days in basic things.
> > >
> > > Thanks.
> > > Guedes
> > >
> > >
> > > On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > > > Anyone please ....
> > > >
> > > > Thanks
> > > > Guedes
> > > >
> > > > On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > > > > Hi, everyone!!
> > > > >
> > > > > Anyone knows why my listener method (remessaBean.delEmbque) is called
> > > > > so many times?
> > > > > It seems the listener is called one time for each line of my table.
> > Is
> > > > > there anything I can do to stop this and call just one time?
> > > > >
> > > > > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values"
> > width="760"
> > > > >                 cellpadding="0" cellspacing="1"
> > > > > rowClasses="inputFields" headerClass="fields">
> > > > >        <x:column>
> > > > >            <f:facet name="header">
> > > > >                <h:outputText value="Excluir" styleClass="forms"/>
> > > > >            </f:facet>
> > > > >            <h:commandButton actionListener="#{remessaBean.delEmbque}"
> > > > > style="cursor:hand;vertical-align:middle;"
> > > > > image="/eServices/eservices/images/trash.gif" />
> > > > >        </x:column>
> > > > >    </x:dataTable>
> > > > >
> > > > >
> > > > > public void delEmbque(ActionEvent e) {
> > > > >
> > > > >           FacesContext context = FacesContext.getCurrentInstance();
> > > > >           Map map =
> > > > context.getExternalContext().getRequestParameterMap();
> > > > >           int index = Integer.parseInt((String) map.get("rowIndex"));
> > > > >
> > > > >           ArrayList currentValues = (ArrayList)
> > > > > valuesEmbqueModel.getWrappedData();
> > > > >           currentValues.remove(index);
> > > > >
> > > > >           valuesEmbqueModel.setWrappedData(currentValues);
> > > > >
> > > > >  }
> > > > >
> > > > > Thanks.
> > > > > Guedes
> > > > >
> > > >
> > >
> >
> >
> > --
> > Mathias
> >
>


--
Mathias

Re: Listener Method is called too many times

Posted by PATRICIA GUEDES <gu...@gmail.com>.
Are you using org.apache.myfaces.component.html.util.ExtensionsFilter?
I am using a workaround for tiles with JSF, because the tiles of
myfaces doesn't work in OC4J.

Thanks for your reply.
Guedes

On 10/27/05, Mathias Brökelmann <mb...@googlemail.com> wrote:
> where do you use your onclick event? I´ve tested your sample and it
> works. The action listener is only called once for the clicked command
> button
>
> 2005/10/27, PATRICIA GUEDES <gu...@gmail.com>:
> > Hi again..
> >
> > I don't know if helps, but I am using
> > org.apache.myfaces.component.html.util.ExtensionsFilter in my web.xml.
> > Another thing that I forgot to tell is that my listener method is
> > called twice for line of my dataTable. I read somewhere that is my
> > onclick event in and out.
> >
> > Please someone help me. I am testing JSF as a pilot to choose between
> > JSF and Struts in a new Project, but I am worried about all these
> > problems. I am stuck for two days in basic things.
> >
> > Thanks.
> > Guedes
> >
> >
> > On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > > Anyone please ....
> > >
> > > Thanks
> > > Guedes
> > >
> > > On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > > > Hi, everyone!!
> > > >
> > > > Anyone knows why my listener method (remessaBean.delEmbque) is called
> > > > so many times?
> > > > It seems the listener is called one time for each line of my table.
> Is
> > > > there anything I can do to stop this and call just one time?
> > > >
> > > > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values"
> width="760"
> > > >                 cellpadding="0" cellspacing="1"
> > > > rowClasses="inputFields" headerClass="fields">
> > > >        <x:column>
> > > >            <f:facet name="header">
> > > >                <h:outputText value="Excluir" styleClass="forms"/>
> > > >            </f:facet>
> > > >            <h:commandButton actionListener="#{remessaBean.delEmbque}"
> > > > style="cursor:hand;vertical-align:middle;"
> > > > image="/eServices/eservices/images/trash.gif" />
> > > >        </x:column>
> > > >    </x:dataTable>
> > > >
> > > >
> > > > public void delEmbque(ActionEvent e) {
> > > >
> > > >           FacesContext context = FacesContext.getCurrentInstance();
> > > >           Map map =
> > > context.getExternalContext().getRequestParameterMap();
> > > >           int index = Integer.parseInt((String) map.get("rowIndex"));
> > > >
> > > >           ArrayList currentValues = (ArrayList)
> > > > valuesEmbqueModel.getWrappedData();
> > > >           currentValues.remove(index);
> > > >
> > > >           valuesEmbqueModel.setWrappedData(currentValues);
> > > >
> > > >  }
> > > >
> > > > Thanks.
> > > > Guedes
> > > >
> > >
> >
>
>
> --
> Mathias
>

Re: Listener Method is called too many times

Posted by Mathias Brökelmann <mb...@googlemail.com>.
where do you use your onclick event? I´ve tested your sample and it
works. The action listener is only called once for the clicked command
button

2005/10/27, PATRICIA GUEDES <gu...@gmail.com>:
> Hi again..
>
> I don't know if helps, but I am using
> org.apache.myfaces.component.html.util.ExtensionsFilter in my web.xml.
> Another thing that I forgot to tell is that my listener method is
> called twice for line of my dataTable. I read somewhere that is my
> onclick event in and out.
>
> Please someone help me. I am testing JSF as a pilot to choose between
> JSF and Struts in a new Project, but I am worried about all these
> problems. I am stuck for two days in basic things.
>
> Thanks.
> Guedes
>
>
> On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > Anyone please ....
> >
> > Thanks
> > Guedes
> >
> > On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > > Hi, everyone!!
> > >
> > > Anyone knows why my listener method (remessaBean.delEmbque) is called
> > > so many times?
> > > It seems the listener is called one time for each line of my table. Is
> > > there anything I can do to stop this and call just one time?
> > >
> > > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
> > >                 cellpadding="0" cellspacing="1"
> > > rowClasses="inputFields" headerClass="fields">
> > >        <x:column>
> > >            <f:facet name="header">
> > >                <h:outputText value="Excluir" styleClass="forms"/>
> > >            </f:facet>
> > >            <h:commandButton actionListener="#{remessaBean.delEmbque}"
> > > style="cursor:hand;vertical-align:middle;"
> > > image="/eServices/eservices/images/trash.gif" />
> > >        </x:column>
> > >    </x:dataTable>
> > >
> > >
> > > public void delEmbque(ActionEvent e) {
> > >
> > >           FacesContext context = FacesContext.getCurrentInstance();
> > >           Map map =
> > context.getExternalContext().getRequestParameterMap();
> > >           int index = Integer.parseInt((String) map.get("rowIndex"));
> > >
> > >           ArrayList currentValues = (ArrayList)
> > > valuesEmbqueModel.getWrappedData();
> > >           currentValues.remove(index);
> > >
> > >           valuesEmbqueModel.setWrappedData(currentValues);
> > >
> > >  }
> > >
> > > Thanks.
> > > Guedes
> > >
> >
>


--
Mathias

Re: Listener Method is called too many times

Posted by PATRICIA GUEDES <gu...@gmail.com>.
Hi again..

I don't know if helps, but I am using
org.apache.myfaces.component.html.util.ExtensionsFilter in my web.xml.
Another thing that I forgot to tell is that my listener method is
called twice for line of my dataTable. I read somewhere that is my
onclick event in and out.

Please someone help me. I am testing JSF as a pilot to choose between
JSF and Struts in a new Project, but I am worried about all these
problems. I am stuck for two days in basic things.

Thanks.
Guedes


On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> Anyone please ....
>
> Thanks
> Guedes
>
> On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> > Hi, everyone!!
> >
> > Anyone knows why my listener method (remessaBean.delEmbque) is called
> > so many times?
> > It seems the listener is called one time for each line of my table. Is
> > there anything I can do to stop this and call just one time?
> >
> > <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
> >                 cellpadding="0" cellspacing="1"
> > rowClasses="inputFields" headerClass="fields">
> >        <x:column>
> >            <f:facet name="header">
> >                <h:outputText value="Excluir" styleClass="forms"/>
> >            </f:facet>
> >            <h:commandButton actionListener="#{remessaBean.delEmbque}"
> > style="cursor:hand;vertical-align:middle;"
> > image="/eServices/eservices/images/trash.gif" />
> >        </x:column>
> >    </x:dataTable>
> >
> >
> > public void delEmbque(ActionEvent e) {
> >
> >           FacesContext context = FacesContext.getCurrentInstance();
> >           Map map =
> context.getExternalContext().getRequestParameterMap();
> >           int index = Integer.parseInt((String) map.get("rowIndex"));
> >
> >           ArrayList currentValues = (ArrayList)
> > valuesEmbqueModel.getWrappedData();
> >           currentValues.remove(index);
> >
> >           valuesEmbqueModel.setWrappedData(currentValues);
> >
> >  }
> >
> > Thanks.
> > Guedes
> >
>

Re: Listener Method is called too many times

Posted by PATRICIA GUEDES <gu...@gmail.com>.
Anyone please ....

Thanks
Guedes

On 10/27/05, PATRICIA GUEDES <gu...@gmail.com> wrote:
> Hi, everyone!!
>
> Anyone knows why my listener method (remessaBean.delEmbque) is called
> so many times?
> It seems the listener is called one time for each line of my table. Is
> there anything I can do to stop this and call just one time?
>
> <x:dataTable value="#{remessaBean.valuesEmbque}" var="values" width="760"
>                 cellpadding="0" cellspacing="1"
> rowClasses="inputFields" headerClass="fields">
>        <x:column>
>            <f:facet name="header">
>                <h:outputText value="Excluir" styleClass="forms"/>
>            </f:facet>
>            <h:commandButton actionListener="#{remessaBean.delEmbque}"
> style="cursor:hand;vertical-align:middle;"
> image="/eServices/eservices/images/trash.gif" />
>        </x:column>
>    </x:dataTable>
>
>
> public void delEmbque(ActionEvent e) {
>
>           FacesContext context = FacesContext.getCurrentInstance();
>           Map map = context.getExternalContext().getRequestParameterMap();
>           int index = Integer.parseInt((String) map.get("rowIndex"));
>
>           ArrayList currentValues = (ArrayList)
> valuesEmbqueModel.getWrappedData();
>           currentValues.remove(index);
>
>           valuesEmbqueModel.setWrappedData(currentValues);
>
>  }
>
> Thanks.
> Guedes
>