Getting name of object in action listener

Ok, so, I have an array of 5 buttons named buttons[5]
all of them have the text 'remove' on them. Is there a way to tell them apart in the action listener?

event.getSource() will return the specific button instance.
button.setActionCommand() and event.getActionCommand()
can be used to differentiate between the buttons.
Five buttons with the same label seems like sketchy design to me.
How can the user tell what they're doing?

Similar Messages

  • Programmatically get name of object?

    Is it possible to call a method on a object to get the name of that object---the variable name, not the name of its class?
    Example:
    Person fred = new Person();
    Person barney = new Person();
    List names = new ArrayList();
    names.add(fred);
    names.add(barney);
    for (Object o : names) {
         System.out.println(o.methodThatGivesObjectName()); // should print "fred" and "barney"
         //...print out other info about the object...
    }It seems like this should be possible, but maybe it's not. BTW, I know I could add a "name" field in this example, but I actually want to do this with other objects, like arrays.
    Thanks,
    Gregory

    GregoryGarretson wrote:
    Is it possible to call a method on a object to get the name of that object---the variable name, not the name of its class?
    Example:
    Person fred = new Person();
    Person barney = new Person();
    List names = new ArrayList();
    names.add(fred);
    names.add(barney);
    for (Object o : names) {
         System.out.println(o.methodThatGivesObjectName()); // should print "fred" and "barney"
         //...print out other info about the object...
    What if you add the following code before putting the objects in the list?
    Person wilma = fred;
    Person betty = barney;You've now got two variables pointing to each object. Which one is the object's "name" and why?
    And if you add this code after adding to the list but before printing
    Person tmp = fred;
    fred = barney;
    barney = tmp;Now fred and barney have swapped which object each points to. What are the "names" of the objects now, and why?

  • How to get the view Object in UserDefined Action

    Hi  All,
       Any body tell me how to get the view object , like the view object avilable in the wdDoModifyView() method as parameter.
    I have requirement like, i want to change the , no of rows displaying in the table should be changed at the runtime based onthe no of rows  selected in the dropdown box.
    The action which i created will be assigned to that dropdown box, on select of the available option, i will get the view object and change the properties of the "maxrows" of the table .
    so for getting the view object in the  the Action methods tell me what is the procedure for getting the current view object.

    Hello Vishal,
    Simply create a value attribute (say rowCount) of type 'integer' and bind it to the 'visibleRowCount' property of your table. Then, in the actionHandler get the value from the UI element (in your case, I guess it is drop down) and set it to the attribute 'rowCount' like this.
    wdContext.currentContextElement.setRowCount(
        wdContext.current<nodeElement>.set<AttributeBound toDropDown>);
    Bala

  • What is the Table/View name for getting the Database Object Dependencies

    I am running the Database Object Dependencies report to get the reference of Database Object and their respective Application Component.
    Applications xxxx -> Application Reports -> Shared Components -> Database Object Dependencies -> Compute Dependencies
    I want to develop a report for the same purpose, Just want to know what is the APEX Tables / Views they are using to run this report, so that I can use the same Tables to create my own report.
    Thanks,
    Deepak

    Hi Andy,
    when I am using the following query...I am not getting any result...
    select name, type, owner
    from all_dependencies
    where referenced_owner = 'APEX_030200'
    and referenced_name = 'WWV_FLOW_PATCHES'
    AND OWNER= 'XXXXXXX' --- (addeed this to the where clause)
    I modified the query.....I am getting the result.....
    select name, type, owner
    from all_dependencies
    AND OWNER= 'XXXXXXX'
    - But I am not getting which database object(table/view) is using which Application Page/Component like we have in Database Object Dependencies.
    - Also what is this REFERENCE OWNER & REFERENCE_NAME ----
    referenced_owner = 'APEX_030200'
    and referenced_name = 'WWV_FLOW_PATCHES'
    I am little bit confused, Can you pl expalin me in details......
    Thanks,
    Deepak

  • How to get text name text object and text id for long text

    Hi,
    I am trying to fetch Long text for a given order number from transaction CO04 in SAPScript. I know that I have to use Include X (OBJECT) XX ID XXX.
    How do I get the text name, text object and text id for the order header long text from Transaction CO04.
    Points will be awarded..
    Tushar

    Tushar,
    When you are in CO02, and are at the Long Text Tab,click on the Icon that is next to the Order Number at the top of the screen (this icon looks like a Pencil and a Pad of Paper and is called "Change Long Text"). When you click on this it will take you to the SAPscript Editor. Now hit Goto->Header and you will get the data you require.
    Hope this helps.
    Cheers,
    Pat.
    PS. Kindly award Reward Points as appropriate.

  • Getting name of action from action guid

    Hi ,
    Can we get name of action excuted from the action guid generated at runtime ... is there any table or someway we can get this ?
    Thanks Vaibhav

    Hi,
    You can refer the table PPFTTRIGG in CRM.
    This will list the action profile and action definitions based on the GUID details.
    Regards,
    PP

  • How to get an initialised Object according to it's name?

    How to get an initialised Object according to it's name?
    For example I have 5 HashSets (initialised, with data) hs1 hs2 hs3 hs4 and hs5
    Sometimes I want to get one of them according to it's number : "hs"+number
    How this can be done (method class.forName is dedicated to antoher thing).
    Thanks

    I forgot to write that I do not want to use a Map :)
    (sure, it' possible via Map, no question).
    But in Perl, for example, I could simply write
    $ab="col" + "or";
    $color="Beidge";
    and than I can use address to a variable $color in
    such a way : $$ab
    ... So if a Map is an only way... than it will be a
    Map... pity..I do not really know Perl so I can not comment on it; but, are there any compiled languages (at least compiled to the degree of Java) that support this construct? All of the programming languages that I can think of that have this construct are more along the lines of scripting languages.
    Just curious.

  • Custom button with action listener - will not invoke action listener

    Hi
    For whatever reason, I cannot find a concise example of a simple custom component that can invoke an action listener. The tutorials I've read so far either ignore this fundamental topic or only make the slightest make reference to it.
    The best I have come up with - in terms of a simple prototype is below... but, the action listener is never invoked.... Can someone tell me what I am missing (full code below). Hopefully, what is missing or incorrect will be obvious to you JSF experts out there.
    Thanks for any help!!
    -f
    tld
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>0.01</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>jsfcustomcomponent</short-name>
      <uri>http://jsfcustomcomponent/</uri>
      <description><![CDATA[jsf custom component tags]]>  </description>
      <tag>
        <name>specialBtnTag</name>
        <tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
        <attribute>
          <name>value</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[button value]]></description>
        </attribute>
        <attribute>
          <name>actionListener</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[action listener]]> </description>
        </attribute>
      </tag>
    </taglib>
    SpecialBtnComponent
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.el.*;
    import javax.faces.event.*;
    public class SpecialBtnComponent
        extends UIComponentBase implements ActionSource
        public static final String COMPONENT_TYPE = "SpecialBtnComponent";
        public static final String RENDERER_TYPE = "SpecialBtnRenderer";
        public String getFamily()
            return COMPONENT_TYPE;
        public SpecialBtnComponent()
            super();
            setRendererType(SpecialBtnComponent.RENDERER_TYPE);
        private String value;
        public void setValue(String value, FacesContext facesContext)
            this.value = value;
        public String getValue()
            if (null != value)
                return value;
            ValueBinding _vb = getValueBinding("value");
            if (_vb != null)
                return (String) _vb.getValue(getFacesContext());
            else
                return null;
        private MethodBinding action = null;
        public MethodBinding getAction()
            return action;
        public void setAction(MethodBinding methodBinding)
            this.action = action;
        private MethodBinding actionListener = null;
        public MethodBinding getActionListener()
            return (this.actionListener);
        public void setActionListener(MethodBinding methodBinding)
            this.actionListener = actionListener;
        public boolean isImmediate()
            return false;
        public void setImmediate(boolean _boolean)
            //this.immediate = immediate;
        public void addActionListener(ActionListener actionListener)
            addFacesListener(actionListener);
        public ActionListener[] getActionListeners()
            return (ActionListener[]) getFacesListeners(ActionListener.class);
        public void removeActionListener(ActionListener actionListener)
            removeFacesListener(actionListener);
        public Object saveState(FacesContext context)
            Object values[] = new Object[5];
            values[0] = super.saveState(context);
            values[1] = value;
            values[2] = saveAttachedState(context, action);
            values[3] = saveAttachedState(context, actionListener);
            return ( (Object) (values));
        public void restoreState(FacesContext context, Object state)
            Object values[] = (Object[]) state;
            super.restoreState(context, values[0]);
            value = (String) values[1];
            action = (MethodBinding) restoreAttachedState(context, values[2]);
            actionListener = (MethodBinding) restoreAttachedState(context, values[3]);
        public void broadcast(FacesEvent event) throws AbortProcessingException
            super.broadcast(event);
            if (event instanceof ActionEvent)
                FacesContext context = getFacesContext();
                MethodBinding mb = getActionListener();
                if (mb != null)
                    mb.invoke(context, new Object[]
                              {event});
                ActionListener listener = context.getApplication().getActionListener();
                if (listener != null)
                    listener.processAction( (ActionEvent) event);
        public void queueEvent(FacesEvent e)
            if (e instanceof ActionEvent)
                if (isImmediate())
                    e.setPhaseId(PhaseId.APPLY_REQUEST_VALUES);
                else
                    e.setPhaseId(PhaseId.INVOKE_APPLICATION);
            super.queueEvent(e);
    SpecialBtnRenderer
    package jsfcustomcomponent;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.event.*;
    import javax.faces.render.*;
    public class SpecialBtnRenderer
        extends Renderer
        String value;
        public SpecialBtnRenderer()
        public void decode(FacesContext context, UIComponent component)
            Map requestMap = context.getExternalContext().getRequestParameterMap();
            String clientId = component.getClientId(context);
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            String value = (String) requestMap.get(clientId);
            if (null != value)
                specialBtnComponent.setValue(value, context);
            ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
            specialBtnComponent.queueEvent(actionEvent);
        public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            ResponseWriter writer = context.getResponseWriter();
            String clientId = component.getClientId(context);
            value = (String) component.getAttributes().get("value");
            if (value == null)
                value = "defaultValue";
            buildSpecialBtn(writer, value, clientId, specialBtnComponent);
        private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
            writer.startElement("table", component);
            writer.startElement("tbody", component);
            writer.startElement("tr", component);
            writer.startElement("td", component);
            value = String.valueOf(value);
            writer.startElement("input", component);
            writer.writeAttribute("type", "submit", null);
            writer.writeAttribute("name", clientId, "clientId");
            writer.writeAttribute("value", value, null);
            writer.endElement("input");
            writer.endElement("td");
            writer.endElement("tr");
            writer.endElement("tbody");
            writer.endElement("table");
    SpecialBtnTag
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.el.*;
    import javax.faces.webapp.*;
    import com.sun.faces.util.*;
    public class SpecialBtnTag
        extends UIComponentTag
        public String value = null;
        public String actionListener = null;
        public String getComponentType()
            return SpecialBtnComponent.COMPONENT_TYPE;
        public String getRendererType()
            return SpecialBtnComponent.RENDERER_TYPE;
        protected void setProperties(UIComponent component)
            super.setProperties(component);
            if (! (component instanceof SpecialBtnComponent))
                throw new IllegalStateException("Component " + component.toString() +
                                                " not expected type.  Expected: jsfcustomcomponent.SpecialBtnComponent.  Perhaps you�re missing a tag?");
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            if (value != null)
                if (isValueReference(value))
                    ValueBinding vb = Util.getValueBinding(value);
                    specialBtnComponent.setValueBinding("value", vb);
                else
                    throw new IllegalStateException("The value for �value� must be a ValueBinding.");
            if (actionListener != null)
                if (isValueReference(actionListener))
                    ValueBinding vb = Util.getValueBinding(actionListener);
                    specialBtnComponent.setValueBinding("actionListener", vb);
                else
                    throw new IllegalStateException("The value for �actionListener� must be a ValueBinding.");
        public void release()
            super.release();
            value = null;
            actionListener = null;
        public void setValue(String value)
            this.value = value;
        public String getValue()
            return this.value;
        public void setActionListener(String actionListener)
            this.actionListener = actionListener;
        public String getActionListener()
            return this.actionListener;
    jsp1.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
    </head>
    <body>
    <f:view>
      <h:form id="form01">
        <h:outputText value="test special button with action listener"/>
        <j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" actionListener="#{specialBtnBacking.specialBtnActionListener}"/>
        <h:messages/>
        <h:outputText value="#{specialBtnBacking.outcome}"/>
      </h:form>
    </f:view>
    </body>
    </html>
    SpecialBtnBacking
    package specialbtn;
    import javax.faces.context.*;
    import javax.faces.event.*;
    public class SpecialBtnBacking
        private FacesContext context;
        public SpecialBtnBacking()
            this.setSpecialBtnValue("Special Button with action listener");
        private String specialBtnValue;
        public String getSpecialBtnValue()
            return this.specialBtnValue;
        public void setSpecialBtnValue(String specialBtnValue)
            this.specialBtnValue = specialBtnValue;
        private String outcome="actionlistener NOT invoked: click specialBtn above to test";
        public String getOutcome()
            return outcome;
        public void setOutcome(String outcome)
            this.outcome = outcome;
        public void specialBtnActionListener(ActionEvent evt)
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            this.outcome="***action listener invoked!!!***";
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <managed-bean>
        <managed-bean-name>specialBtnBacking</managed-bean-name>
        <managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      <component>
        <component-type>SpecialBtnComponent</component-type>
        <component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
        <component-extension>
          <renderer-type>SpecialBtnRenderer</renderer-type>
        </component-extension>
      </component>
      <render-kit>
        <renderer>
          <component-family>SpecialBtnComponent</component-family>
          <renderer-type>SpecialBtnRenderer</renderer-type>
          <renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
        </renderer>
      </render-kit>
    </faces-config>
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <display-name>pagerWEB</display-name>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
      <jsp-config>
        <taglib>
          <taglib-uri>http://jsfcustomcomponent/</taglib-uri>
          <taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
        </taglib>
      </jsp-config>
      <servlet>
        <description>Added by JBuilder to compile JSPs with debug info</description>
        <servlet-name>debugjsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
          <param-name>classdebuginfo</param-name>
          <param-value>true</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>debugjsp</servlet-name>
        <url-pattern>*.jsp</url-pattern>
      </servlet-mapping>
    </web-app>

    got it working....
    The changes were:
    in "SpecialBtnRenderer"...
    --new--
                        mb.invoke(context, new Object[1]);
    --old--
                        mb.invoke(context, new Object[0]);
    in "SpecialBtnTag"...
    --new--
    import javax.faces.event.ActionEvent;
    --new--
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
    --old--
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, null);
    -Below is the entire application, again -- for those (like myself) who need concrete examples...
    I hope this helps someone else! --f
    jsp1.jsp
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
    <%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
    <%@taglib uri="http://jsfcustomcomponent/" prefix="j"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    <link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">
    </head>
    <body>
    <f:view>
        <h:messages/>
      <h:form id="form01">
        <h:outputText value="test special button with action listener"/>
        <j:specialBtnTag value="#{specialBtnBacking.specialBtnValue}" specialBtnListener="#{specialBtnBacking.specialBtnActionListener}"/>
        <h:outputText value="#{specialBtnBacking.outcome}"/>
      </h:form>
    </f:view>
    </body>
    </html>
    SpecialBtnBacking
    package specialbtn;
    import javax.faces.context.*;
    import javax.faces.event.*;
    public class SpecialBtnBacking
        private FacesContext context;
        public SpecialBtnBacking()
            this.setSpecialBtnValue("Special Button with action listener");
        private String specialBtnValue;
        public String getSpecialBtnValue()
            return this.specialBtnValue;
        public void setSpecialBtnValue(String specialBtnValue)
            this.specialBtnValue = specialBtnValue;
        private String outcome = "actionlistener NOT invoked: click specialBtn above to test";
        public String getOutcome()
            return outcome;
        public void setOutcome(String outcome)
            this.outcome = outcome;
        public void specialBtnActionListener(ActionEvent evt)
            System.out.println("\n\n");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
            System.out.println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Jsp1Backing/specialBtnActionListener()!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");
            this.outcome = "***action listener invoked!!!***";
    jsfcustomcomponent.tld
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
    <taglib>
      <tlib-version>0.01</tlib-version>
      <jsp-version>1.2</jsp-version>
      <short-name>jsfcustomcomponent</short-name>
      <uri>http://jsfcustomcomponent/</uri>
      <description><![CDATA[jsf custom component tags]]>  </description>
      <tag>
        <name>specialBtnTag</name>
        <tag-class>jsfcustomcomponent.SpecialBtnTag</tag-class>
        <attribute>
          <name>value</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[button value]]></description>
        </attribute>
        <attribute>
          <name>specialBtnListener</name>
          <required>true</required>
          <rtexprvalue>true</rtexprvalue>
          <description><![CDATA[action listener]]> </description>
        </attribute>
      </tag>
    </taglib>
    faces-config.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN" "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
    <faces-config>
      <managed-bean>
        <managed-bean-name>specialBtnBacking</managed-bean-name>
        <managed-bean-class>specialbtn.SpecialBtnBacking</managed-bean-class>
        <managed-bean-scope>request</managed-bean-scope>
      </managed-bean>
      <component>
        <component-type>SpecialBtnComponent</component-type>
        <component-class>jsfcustomcomponent.SpecialBtnComponent</component-class>
        <component-extension>
          <renderer-type>SpecialBtnRenderer</renderer-type>
        </component-extension>
      </component>
      <render-kit>
        <renderer>
          <component-family>SpecialBtnComponent</component-family>
          <renderer-type>SpecialBtnRenderer</renderer-type>
          <renderer-class>jsfcustomcomponent.SpecialBtnRenderer</renderer-class>
        </renderer>
      </render-kit>
    </faces-config>
    SpecialBtnComponent.java
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.el.*;
    import javax.faces.event.*;
    public class SpecialBtnComponent
        extends UIComponentBase implements ActionSource
        public static final String COMPONENT_TYPE = "SpecialBtnComponent";
        public static final String RENDERER_TYPE = "SpecialBtnRenderer";
        public String getFamily()
            return COMPONENT_TYPE;
        public SpecialBtnComponent()
            super();
            setRendererType(SpecialBtnComponent.RENDERER_TYPE);
        private String value;
        public void setValue(String value, FacesContext facesContext)
            this.value = value;
        public String getValue()
            if (null != this.value)
                return this.value;
            ValueBinding _vb = getValueBinding("value");
            if (_vb != null)
                return (String) _vb.getValue(getFacesContext());
            else
                return null;
        private MethodBinding specialBtnListener = null;
        public MethodBinding getActionListener()
            return (this.specialBtnListener);
        public void setActionListener(MethodBinding actionListener)
            this.specialBtnListener = actionListener;
        public Object saveState(FacesContext context)
            Object values[] = new Object[3];
            values[0] = super.saveState(context);
            values[1] = saveAttachedState(context, this.specialBtnListener);
            values[2] = this.value;
            return (values);
        public void restoreState(FacesContext context, Object state)
            Object values[] = (Object[]) state;
            super.restoreState(context, values[0]);
            this.specialBtnListener = (MethodBinding) restoreAttachedState(context, values[1]);
            this.value = (String) restoreAttachedState(context, values[2]);
        public void broadcast(FacesEvent event) throws AbortProcessingException
            super.broadcast(event);
            if (event instanceof ActionEvent)
                FacesContext context = getFacesContext();
                MethodBinding mb = this.getActionListener();
                if (mb != null)
                    try
                        mb.invoke(context, new Object[]
                                  {event});
                    catch (EvaluationException ex)
                        System.out.println("SpecialBtnComponent/broadcast(FacesEvent event)...EvaluationException encountered - ex.getMessage()=" + ex.getMessage());
                        ex.printStackTrace();
                ActionListener actionListener = context.getApplication().getActionListener();
                if (actionListener != null)
                    actionListener.processAction( (ActionEvent) event);
        public void queueEvent(FacesEvent e)
            if (e instanceof ActionEvent)
                e.setPhaseId(PhaseId.INVOKE_APPLICATION);
            super.queueEvent(e);
        public MethodBinding getAction()
            return null;
        public void setAction(MethodBinding methodBinding)
        public boolean isImmediate()
            return false;
        public void setImmediate(boolean _boolean)
        public void addActionListener(ActionListener actionListener)
            addFacesListener(actionListener);
        public ActionListener[] getActionListeners()
            return (ActionListener[]) getFacesListeners(ActionListener.class);
        public void removeActionListener(ActionListener actionListener)
            removeFacesListener(actionListener);
    SpecialBtnTag.java
    package jsfcustomcomponent;
    import javax.faces.component.*;
    import javax.faces.el.*;
    import javax.faces.webapp.*;
    import com.sun.faces.util.*;
    import javax.faces.context.FacesContext;
    import javax.faces.event.ActionEvent;
    public class SpecialBtnTag
        extends UIComponentTag
        public String value = null;
        public String specialBtnListener = null;
        private SpecialBtnComponent specialBtnComponent;
        public SpecialBtnTag()
            super();
        public String getComponentType()
            return SpecialBtnComponent.COMPONENT_TYPE;
        public String getRendererType()
            return SpecialBtnComponent.RENDERER_TYPE;
        protected void setProperties(UIComponent component)
            super.setProperties(component);
            if (! (component instanceof SpecialBtnComponent))
                throw new IllegalStateException("Component " + component.toString() +
                                                " not expected type.  Expected: jsfcustomcomponent.SpecialBtnComponent.  Perhaps you�re missing a tag?");
            specialBtnComponent = (SpecialBtnComponent) component;
            if (value != null)
                if (isValueReference(value))
                    ValueBinding vb = Util.getValueBinding(value);
                    specialBtnComponent.setValueBinding("value", vb);
                else
                    throw new IllegalStateException("The value for �value� must be a ValueBinding.");
            if (specialBtnListener != null)
                if (isValueReference(specialBtnListener))
                    MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding(specialBtnListener, new Class[]{ActionEvent.class});
                    ( (SpecialBtnComponent) component).setActionListener(mb);
                else
                    MethodBinding mb = Util.createConstantMethodBinding(specialBtnListener);
                    ( (SpecialBtnComponent) component).setActionListener(mb);
        public void release()
            super.release();
            value = null;
            specialBtnListener = null;
        public void setValue(String value)
            this.value = value;
        public String getValue()
            return this.value;
        public void setSpecialBtnListener(String specialBtnListener)
            this.specialBtnListener = specialBtnListener;
        public String getSpecialBtnListener()
            return this.specialBtnListener;
    SpecialBtnRenderer
    package jsfcustomcomponent;
    import java.util.*;
    import javax.faces.component.*;
    import javax.faces.context.*;
    import javax.faces.event.*;
    import javax.faces.render.*;
    import javax.faces.el.MethodBinding;
    import javax.faces.el.*;
    public class SpecialBtnRenderer
        extends Renderer
        String value;
        public SpecialBtnRenderer()
            super();
        public void decode(FacesContext context, UIComponent component)
            try
                Map requestMap = context.getExternalContext().getRequestParameterMap();
                String clientId = component.getClientId(context);
                SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
                String value = (String) requestMap.get(clientId);
                if (null != value)
                    specialBtnComponent.setValue(value, context);
                    MethodBinding mb = specialBtnComponent.getActionListener();
                    if (mb != null)
                        System.out.println("SpecialBtnRenderer/decode...mb.getExpressionString()=" + mb.getExpressionString());
                        //mb.invoke(context, new Object[0]);
                        mb.invoke(context, new Object[1]);
                    ActionEvent actionEvent = new ActionEvent(specialBtnComponent);
                    specialBtnComponent.queueEvent(actionEvent);
            catch (EvaluationException ex)
                ex.printStackTrace();
        public void encodeEnd(FacesContext context, UIComponent component) throws java.io.IOException
            SpecialBtnComponent specialBtnComponent = (SpecialBtnComponent) component;
            ResponseWriter writer = context.getResponseWriter();
            String clientId = component.getClientId(context);
            value = (String) component.getAttributes().get("value");
            if (value == null)
                value = "defaultValue";
            buildSpecialBtn(writer, value, clientId, specialBtnComponent);
        private void buildSpecialBtn(ResponseWriter writer, String value, String clientId, SpecialBtnComponent component) throws java.io.IOException
            writer.startElement("table", component);
            writer.startElement("tbody", component);
            writer.startElement("tr", component);
            writer.startElement("td", component);
            value = String.valueOf(value);
            writer.startElement("input", component);
            writer.writeAttribute("type", "submit", null);
            writer.writeAttribute("name", clientId, "clientId");
            writer.writeAttribute("value", value, null);
            writer.endElement("input");
            writer.endElement("td");
            writer.endElement("tr");
            writer.endElement("tbody");
            writer.endElement("table");
    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
      <display-name>pagerWEB</display-name>
      <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
      </servlet-mapping>
      <jsp-config>
        <taglib>
          <taglib-uri>http://jsfcustomcomponent/</taglib-uri>
          <taglib-location>/WEB-INF/jsfcustomcomponent.tld</taglib-location>
        </taglib>
      </jsp-config>
    </web-app>

  • Property on Backing Bean is Not set when Action Listener is Fired

    Why is it that when my action listener is invoked, the property for my other component on the page has not been reflected in model yet?
    Here is what I have:
    My JSP has the following two components:
    <h:inputText value="#{manageQuestionBean.newStory}"></h:inputText>
    <h:commandButton value="add" actionListener="#{manageQuestionBean.onAddStory}"></h:commandButton> My Java code has the following:
    public void onAddStory(ActionEvent event) {
           //This always prints out 'null'
           System.out.println("The value of 'newStory' is: " + newStory);
          //TO DO: this is where the logic would go for creating a new story object.
        } When I put logging statements inside my setter for the newStory property, I see that it is being set to the right value, but then it being reset to empty string. Why is that? During what phase do the action listeners get invoked?

    Which JSF implementation/version are you using?
    mczauz wrote:
    When I put logging statements inside my setter for the newStory property, I see that it is being set to the right value, but then it being reset to empty string. Why is that? When exactly happens when exactly?
    During what phase do the action listeners get invoked?The invoke application phase, after the update model values phase.
    You may find this article useful to learn about phases and how to add a 'phase debugger' yourselfl: [http://balusc.blogspot.com/2006/09/debug-jsf-lifecycle.html].

  • Issue with setting an Action Listener for a Command Button

    Hi all,
    I'm trying to set an action listener for a CoreCommanButton in a backing bean. Here's my code:
         CoreCommandButton editBtn = new CoreCommandButton();
              MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{backBean.doButtonAct}",null);
              editBtn.setActionListener(mb);
    //Action listener method
         public void doButtonAct(ActionEvent actionEvent)
    I keep getting a javax.faces.el.MethodNotFoundException error. However when I remove the ActionEvent parameter in doButtonAct(), I get a wrong number of arguments error.
    So i'm guessing there is something wrong with the parameters i accept in my action listener method. what can be causing this issue?
    Cheers.

    I figured this out.
    Since doButtonAct() requires an ActionEvent object as a parameter, i needed to define the parameter type when I create the method binding.
    Solution:
         Class argsString[] = new Class[] { ActionEvent.class };
              MethodBinding mb = FacesContext.getCurrentInstance().getApplication().createMethodBinding("#{backBean.doButtonAct}",argsString);

  • Action Listener Method called multiple times

    I have a page (fragment .jsff), containing a simple input text and a button called "search". When I click on "Search" the action listener is triggered multiple times. (The results are displayed in a table inside a panel collection).
    The results are actually coming back ok.
    When I debug the code, I can see the action listener method called twice.
    Do you know why is that?
    What should I be taking care of?
    This is my code :
    *** Fragment ****
    <af:commandButton text="#{identityBundle.search_label}" id="cb1"
    actionListener="#{UserDetailsBean.searchUsersListener}"
    disabled="#{!bindings.searchUsers.enabled}"/>
    *** Managed bean ***
    public void searchUsersListener(ActionEvent actionEvent) {
    // Add event code here...
    DCBindingContainer bindings = (DCBindingContainer)getBindings();
    DCIteratorBinding iter = bindings.findIteratorBinding("userIterator");
    DCDataRow row = (DCDataRow)iter.getCurrentRow();
    User user = (User)row.getDataProvider();
    boolean isSearchCriteriaPresent = false;
    if(user != null){
    String fn = user.getFirstname();
    if(fn != null && !fn.trim().equals("")){
    isSearchCriteriaPresent = true;
    user.setLastname(fn);
    user.setNonMTUserLogin(fn);
    try {
    Map <Object, Object> userMap = PropertyUtils.describe(user);
    for(Map.Entry<Object, Object> entry: userMap.entrySet()){
    if(entry.getKey() != null && entry.getValue() != null && !entry.getKey().toString().equalsIgnoreCase("class")){
    isSearchCriteriaPresent = true;
    break;
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (InvocationTargetException e) {
    e.printStackTrace();
    } catch (NoSuchMethodException e) {
    e.printStackTrace();
    if(!isSearchCriteriaPresent){
    user.setFirstname("*");
    OperationBinding opBinding = (OperationBinding)bindings.getOperationBinding("searchUsers");
    opBinding.getParamsMap().put("user", user);
    opBinding.execute();
    AdfFacesContext adfFacesCtx = AdfFacesContext.getCurrentInstance();
    Map<String, Object> scopePageFlowScopeVar= adfFacesCtx.getPageFlowScope();
    scopePageFlowScopeVar.put("userSearchCriteria", user);
    ADFContext adfCtx = ADFContext.getCurrent();
    Map sessionScope = adfCtx.getSessionScope();
    sessionScope.put("userSearchCriteria", user);
    setUserSearchCriteria(user);
    if(selectedUserID != null){
    selectedUserID.setValue(null);
    RichTable table = getUserResultsTable();
    DCIteratorBinding searchUsersIterator = (DCIteratorBinding)bindings.get("searchUsersIterator");
    Row[] rows = searchUsersIterator.getAllRowsInRange();
    if(rows.length > 0){
    RowKeySetImpl rks = new RowKeySetImpl();
    ArrayList keyList = new ArrayList();
    keyList.add(rows[0].getKey());
    rks.add(keyList);
    table.setSelectedRowKeys(rks);
    table.setDisplayRowKey(keyList);
    refreshState(table);
    if(!isSearchCriteriaPresent){
    user.setFirstname(null);
    else{
    deleteUserButton.setDisabled(true);
    resetPasswordButton.setDisabled(true);
    enableUserButton.setDisabled(true);
    disableUserButton.setDisabled(true);
    Thanks in advance for your help

    Hi,
    Can you try this?
    1. set partialSubmit=true for the "search" button
    2. set "search" button id as partialTrigger in your result table
    -Prasad

  • Getting info on objects loaded via xml

    Hello:
    i am a beginner/intermediate as3 coder, and i am stuck on
    something related to objects loaded via XML.
    i am able to load JPEG images onto a simulated "shelf", but i
    am trying to arrange them on the shelf (like a store shelf) so that
    each new item is placed directly next to the previous item as they
    load. i can get it to work on a very basic level by specifying the
    spacing between items manually betwen the code, but to makre this
    reuseable and efficient, the ideal is to have the "next" object
    loaded be placed on the shelf based on the width of the previous
    object. but when i try to access the width of the object that is
    loaded via the imageLoader, i can;t find it. if i trace the image
    loader wifth, it is 0; i have tried several ways to name the object
    as it loads and then get/save its dimensions somehow, but i am not
    having any luck. i use all the Lynda titles and i also use some of
    the better books, but i just can;t seem to solve this.
    any hellp would be appreciated.
    thank you.

    Thak you for this -- it did help somewhat, but i am still
    stuck.
    When i use the contentLoaderInfo listener, you are right, i
    can discern the width of the loader. but when i do this it only
    works for the last item loaded. here is my problem -- i am trying
    to load graphics dynamically, and have each graphic go to it's
    proper "place" on a simulated shelf -- so the foirst object might
    go to (0,0), then next object should go directly to the right of
    the first object, etc, etc. and i am loading all this dynamically
    from an xml file. if i just specify a distance, then i can get
    everything to load at uniform distances from each other. problem is
    each of the graphics has a unique width, height, etc, so i need to
    be able to "catch and capture" this info as each one is loaded.
    when i wait until the entire loader has loaded, the only
    peopoerties left for me to capture and use are the propoerties of
    the last itm loaded.
    any ideas on how to do this -- anyone?
    thanks very much, i just can't seem to figure this out.

  • Trying to write Event or Action Listener

    I believe what I am trying to write is an Event Listener (it may be the case that I want to be writing an entirely different type of class), but I don't seem to be having any success.
    I currently have two classes that I want to establish a Listener (whether it be Action or Event, I don't know) relationship between.
    One of the classes (class Container) has a container (let's say a Vector for simplicity) and throughout the program's lifetime I add elements to the container. Therefore, I have a generic addElement method in class Container. And lets say I have another class (class ContainerListener). I want class ContainerListener to know whenever class Container's method addElement is called.
    So I thought I could make them ActionListeners or something and class ContainerListener could be informed whenever class Container add's an element to its container.
    This is where I got with the Container class:
    package com.timCassidy.misc;
    import java.util.*;
    import java.awt.event.*;
    public class Container implements ActionListener{
    private Vector m_vectorOfElements;
    /** Creates new Container */
    public Container() {
    m_vectorOfElements = new Vector();
    public void addElement (String _text){
    m_vectorOfElements.addElement (_text);
    public void actionPerformed(ActionEvent e) {
    System.out.println ("this shouldn't be getting called as I haven't registered this object with any other object as a listener");
    public static void main (String [] args){
    And this is where I got with the ContainerListener class:
    package com.timCassidy.misc;
    import java.awt.event.*;
    public class ContainerListener implements ActionListener{
    /** Creates new ContainerListener */
    public ContainerListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println ("an element has been added to the container");
    public static void main (String [] args){
    ContainerListener containerListener = new ContainerListener();
    com.timCassidy.misc.Container container = new com.timCassidy.misc.Container();
    container.addActionListener (containerListener);
    container.addElement ("tim");
    This is the compiler error I get:
    com/timCassidy/misc/ContainerListener.java [21:1] cannot resolve symbol
    symbol : method addActionListener (com.timCassidy.misc.ContainerListener)
    location: class com.timCassidy.misc.Container
    container.addActionListener (containerListener);
    ^
    I assume this problem stems from the fact that my Container class doesn't implement/extend some class that has the method ActionPerformed in it???
    Can someone tell me how to fix these classes or just the Container class if that is all that is necessary.
    Thanks,
    Tim

    This seems to work, what do you think:
    package com.timCassidy.misc;
    import java.util.*;
    import java.awt.event.*;
    public class Container implements ActionListener{
    private Vector m_vectorOfElements;
    private Vector m_registeredListeners;
    /** Creates new Container */
    public Container() {
    m_vectorOfElements = new Vector();
    m_registeredListeners = new Vector();
    public void addElement (String _text){
    m_vectorOfElements.addElement (_text);
    for (int i = 0;i < m_registeredListeners.size();i++){
    ActionListener listener = (ActionListener)m_registeredListeners.elementAt(i);
    listener.actionPerformed(new ActionEvent(this,0,"blah"));
    public void addActionListener(Object _class) {
    if (_class instanceof ContainerListener){
    m_registeredListeners.addElement(_class);
    public void actionPerformed(ActionEvent e) {
    System.out.println ("this shouldn't be getting called as I haven't registered this object with any other object as a listener");
    public static void main (String [] args){

  • Export collection action listener error after second call

    Hi all,
    I am using the operation export collection action listener to export to excel the content of a table. The first time I clicked the button to export, Microsoft Excel open with the table  information correctly but if  I want to export again then I got the following error:
    <08-ago-2013 21H54' VET> <Error> <oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter> <BEA-000000> <ADF_FACES-60096:Excepción del Servidor durante PPR, #1
    java.lang.IllegalStateException: ADF_FACES-60003: Component with ID: pt1:r8:4:b1 not registered for Active Data.
      at oracle.adfinternal.view.faces.activedata.PageDataUpdateManager.unregisterComponent(PageDataUpdateManager.java:615)
      at oracle.adfinternal.view.faces.context.RichPhaseListener.handleStartAndStopActiveData(RichPhaseListener.java:478)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:540)
      at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:225)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:280)
      at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:254)
      at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:136)
      at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:341)
      at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:192)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:106)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)
      at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:478)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:303)
      at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:208)
      at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:202)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:137)
      at java.security.AccessController.doPrivileged(Native Method)
      at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
      at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)
      at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:120)
      at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:217)
      at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:81)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:225)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
      at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:79)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3367)
      at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3333)
      at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
      at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
      at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:57)
      at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2220)
      at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2146)
      at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2124)
      at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1564)
      at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:254)
      at weblogic.work.ExecuteThread.execute(ExecuteThread.java:295)
      at weblogic.work.ExecuteThread.run(ExecuteThread.java:254)
    Any Idea?
    Jhon Carrillo
    Jdev 12c

    Hi,
    there is a bug filed for this that has been fixed for the first (upcoming) Patch Set of 12c. Until then the solution seems to be to get the current row before exporting the table and then to set it back afterwards. So what you can try is to create a hidden button for the export of the table. Say you name the button "expBut". Then have another button with a action reference to a managed bean. This button now will invoke the following code
    1. read the current row from the table iterator (bindings --> (DCIteratorBinding) bindings.get("iteratorName") --> (Row) dcIterator.getCurrentRow()
    2. invoke the hidden button: ActionEvent ae = new ActionEvent(expBut); ae.queue();
    3. Set current row back to where it was: dcIterator.setCurrentRowWithKey(row.getKey().toStringFormat(true));
    At least this seems to be the internal bug fix.
    Alternatively, disable PPR on the binding layer (ChangeEventPolicy=None on the iterator) and set the same on the PartialTrigger property of the component.
    Frank

  • Action listener activation in many phases

    I need action listener (methods) to be activated in many phases. I.e., when the user clicks a submit button, I want code to be executed (in my case) after the validation phase and after (during) the invoke application phase. In earlier version of the standard, I would just register 2 listeners, returning the appropriate getPhaseId() value. Since this method is removed from the current standard, things get more complicated.
    QUESTION: Why in heavens name was this method removed from the standard? I suppose, because it is difficult to support with listener methods (in contrast to instances)? Bit of a rough solution, no? Or am I missing something?
    I have a solution now, I think, that is based on getting the action event immediate, and requeuing the event again and again.
    In the JSP, in the JSF form, I have a submit button as follows:
    <h:commandButton id="buttonId" value="ButtonText"
                     actionListener="#{handler.buttonListener}"
                     immediate="true"/>The method Handler.buttonListener is:
      public final void buttonListener(ActionEvent ae) {
        LOG.debug("Handler. buttonListener called ("
                  + "ActionEvent.getPhaseId() = " + ae.getPhaseId()
                  + "; ActionEvent.getComponent() = " + ae.getComponent()
                  + ")");
        PhaseId phaseId = ae.getPhaseId();
        if (phaseId.equals(PhaseId.APPLY_REQUEST_VALUES)) {
          LOG.debug("-- processing during " + ae.getPhaseId());
          // meaningful stuff here
          // prepare for execution in next phase
          ae.queue();
            /* this sets phase id to the current phase, so it is extremely important that
             * we set the necessary phase id AFTER queuing the event */
          ae.setPhaseId(PhaseId.PROCESS_VALIDATIONS);
          LOG.debug("-- ActionEvent (getPhaseId() = " + ae.getPhaseId() + ") queued");     
        else if (phaseId.equals(PhaseId.PROCESS_VALIDATIONS)) {
          LOG.debug("-- processing during " + ae.getPhaseId());
          // meaningful stuff here
          // prepare for execution in next phase
          ae.queue();
          /* this sets phase id to the current phase, so it is extremely important that
           * we set the necessary phase id AFTER queuing the event */
          ae.setPhaseId(PhaseId.INVOKE_APPLICATION);
          LOG.debug("-- ActionEvent (getPhaseId() = " + ae.getPhaseId() + ") queued");     
        else if (phaseId.equals(PhaseId.INVOKE_APPLICATION)) {
          LOG.debug("-- processing during " + ae.getPhaseId());
          // meaningful stuff here
        LOG.debug("Handler. buttonListener done");
      }The /* */ comment in the code is there because the queue methods (on the event as well as the component) set the phase id of the event to the current phase. If I set the phase id of the event before queuing it, that setting is undone, and I get an infinite loop! This is weird, and my solution is at least shaky: it doesn't feel stable across JSF implementations and future releases. I could not find a queue method that leaves the phase id alone.
    QUESTION: am I missing something?
    The output however is:
    Mar 21, 2005 12:51:11 PM org.exadel.jsf.PhaseTracker beforePhase
    INFO: BEFORE RESTORE_VIEW 1
    Mar 21, 2005 12:51:11 PM org.exadel.jsf.PhaseTracker afterPhase
    INFO: AFTER RESTORE_VIEW 1
    Mar 21, 2005 12:51:11 PM org.exadel.jsf.PhaseTracker beforePhase
    INFO: BEFORE APPLY_REQUEST_VALUES 2
    12:51:12,119 DEBUG Handler:550 - Handler.buttonListener called
          (ActionEvent.getPhaseId() = APPLY_REQUEST_VALUES 2;
           ActionEvent.getComponent() = javax.faces.component.html.HtmlCommandButton@33b99a)
    12:51:12,171 DEBUG Handler:556 - -- processing during APPLY_REQUEST_VALUES 2
    12:51:12,184 DEBUG Handler:564 - -- ActionEvent (getPhaseId() = PROCESS_VALIDATIONS 3) queued
    12:51:12,189 DEBUG Handler:580 - Handler.buttonListener done
    12:51:12,220 DEBUG Handler:550 - Handler.buttonListener called
         (ActionEvent.getPhaseId() = PROCESS_VALIDATIONS 3;
          ActionEvent.getComponent() = javax.faces.component.html.HtmlCommandButton@33b99a)
    12:51:12,255 DEBUG Handler:567 - -- processing during PROCESS_VALIDATIONS 3
    12:51:12,256 DEBUG Handler:574 - -- ActionEvent (getPhaseId() = INVOKE_APPLICATION 5) queued
    12:51:12,257 DEBUG Handler:580 - Handler.buttonListener done
    12:51:12,265 DEBUG Handler:550 - Handler.buttonListener called
        (ActionEvent.getPhaseId() = INVOKE_APPLICATION 5;
         ActionEvent.getComponent() = javax.faces.component.html.HtmlCommandButton@33b99a)
    12:51:12,267 DEBUG Handler:577 - -- processing during INVOKE_APPLICATION 5
    12:51:12,268 DEBUG Handler:580 - Handler.buttonListener done
    Mar 21, 2005 12:51:12 PM org.exadel.jsf.PhaseTracker afterPhase
    INFO: AFTER APPLY_REQUEST_VALUES 2
    Mar 21, 2005 12:51:12 PM org.exadel.jsf.PhaseTracker beforePhase
    INFO: BEFORE RENDER_RESPONSE 6
    Mar 21, 2005 12:51:12 PM org.exadel.jsf.PhaseTracker afterPhase
    INFO: AFTER RENDER_RESPONSE 6The info is generated by a phase listener I found somewhere (sorry for the lack of reference here to the author). As you can see, I get 3 consecutive calls of my listener method, but they are all during the apply request values phase, and we jump from the apply request values phase immediately to the render response phase, skipping all the other phases, although my listener is actually called 3 times.
    QUESTION: what the fuck? What is happening here, and more important, how can I fix it?

    I am in touch with IBM about any patch they might have for this. I just thought I'd post details from what I researched.
    Basically I found that if I had CommandButton and/or CommandLink components on my page and clicked them for a total greater than 15 times, the application just quit reacting to any of the clicks. After writing a PhaseListener I discovered that after 15 clicks the JSF lifecycle was going straight from the Restore View (1) to Render Response (6) phase instead of going through the ones in between.
    I downloaded the JSF source code and tracked down the magic number 15. As mentioned earlier in this forum it has to do with the number of views per session. In the Sun JSF-RI com.sun.faces.application.StateManagerImpl class
    the number of views is defaulted to 15. When the number of views hits the max the oldest view is deleted. Somehow I don't think they are deleting the oldest view or else why my app quits after 15 clicks I do not know. Anyway this is a known issue with the Sun JSF-RI and documented in their Release Notes.
    Depending on the JSF implementation there may or may not be a workaround. I mean to say the the workaround is not part of the JSF spec but Sun's implementation has a feature where you can configure the com.sun.faces.NUMBER_OF_VIEWS_IN_SESSION value in the web.xml file under the <context-param> tag. If you set the value sufficiently high you lower the risk of the app quitting on you (like a user may be unlikely to make 100 or even 50 clicks on the same page). You might also want to set the state to be saved on the server by setting javax.faces.STATE_SAVING_METHOD to server in another <context-param> tag. Somehow setting this state to client caused errors (NullPointerException) in our app in one of the Faces classes itself.
    Hope this helps someone out there.

Maybe you are looking for

  • RMAN duplicate errors

    Hi: I was doing a 11g database clone on linux using rman duplicate. After runing 40min, it stopped and got the following errors. All the file permission are the same 777, one third of files have been copied. ORA-27041: unable to open file Linux-x86_6

  • Opening Centered Pop-up window with Dynamic URL

    I got some code for a centered pop-up window in Flash from a Kirupa tutorial. It works well, except that you are supposed to put an actual URL for the 'address' variable. I'm using a dynamic URL (+url[p]+) for my URL. When I put address = "'+url[p]'"

  • After update, no computer information, no reports

    After installing OS X 10.5.x on a PPC (upgrade from 10.4.11.) I experience several issues. One of them is related to ARD 3.3: After doing the upgrade, installing all other updates and security fixes, I'm just able to view and control computers via AR

  • Solaris 10 Dev. Edition & Netgear FA311 or DLink 530/550

    I have an nForce 430 integrated NIC, but I have not benn able to get it to work. I have used the drivers on hompage2.nifty, but without success. I get the device installed, but it does not see the router. Any way I am looking at the possibliity of ge

  • CRM - ECC Integration

    Hello Everyone, We are trying to prototype the WebChannel part of CRM 7.0. However, as part of the prototype we'd like to leverage our SAP ECC 6.0 system to connect the CRM system to. But we are not sure what impact does connecting CRM to ECC will ha