You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by "Boyle, PJ" <PJ...@agriculture.gov.ie> on 2008/03/18 16:20:25 UTC

How to invoke ActionListener for menuitem in XMLMenuModel?

Hi,

I am trying to get an ActionListener invoked when a menuitem defined in an XMLMenuModel is clicked, I have defined a class
that implements the ActionListener interface as follows:

public class UserMenuSelectActionListener
{
    public void processAction(ActionEvent actionEvent)
        throws AbortProcessingException
    {
        // the component that triggered the action event
        UIComponent component = actionEvent.getComponent();
        System.out.println("The id of the component that fired the action event: " + component.getId());

    }
}

I have an itemnode defined in a menu-metadata.xml as follows:

<itemNode id="reports" label="#{res.sso_username}" action="UserSearchOutcome" focusViewId="" actionListener="#{'user_menu_select_actionlistener.processAction'}">

I have a backing bean defined in faces-config.xml for user_menu_select_actionlistener:

<managed-bean>
    <managed-bean-name>user_menu_select_actionlistener</managed-bean-name>
    <managed-bean-class>ie.gov.agriculture.sso.trinidad.UserMenuSelectActionListener</managed-bean-class>
    <managed-bean-scope>application</managed-bean-scope>
</managed-bean>

And finally I have the page where the menu is defined:

<tr:navigationPane binding="#{backing_index.navigationPane1}"
id="navigationPane1" hint="tabs"
var="foo" value="#{root_menu}"
level="1">
<f:facet name="nodeStamp">
<tr:commandNavigationItem text="#{foo.label}" action="#{foo.doAction}"
actionListener="#{foo.actionListener }"/>
</f:facet>
</tr:navigationPane>

When I try to run this I get the following:


“javax.faces.el.MethodNotFoundException: processAction: java.lang.String.processAction(javax.faces.event.ActionEvent)”



Does anybody have any tips on where the problem is please?



Pj.




________________________________
Department of Agriculture, Fisheries and Food

The information contained in this email and in any attachments is confidential and is designated solely for the attention and use of the intended recipient(s). This information may be subject to legal and professional privilege. If you are not an intended recipient of this email, you must not use, disclose, copy, distribute or retain this message or any part of it. If you have received this email in error, please notify the sender immediately and delete all copies of this email from your computer system(s).

An Roinn Talmhaíochta, Iascaigh agus Bia

Tá an t-eolais san ríomhphost seo, agus in aon ceangláin leis, faoi phribhléid agus faoi rún agus le h-aghaigh an seolaí amháin. D’fhéadfadh ábhar an seoladh seo bheith faoi phribhléid profisiúnta nó dlíthiúil. Mura tusa an seolaí a bhí beartaithe leis an ríomhphost seo a fháil, tá cosc air, nó aon chuid de, a úsáid, a chóipeál, nó a scaoileadh. Má tháinig sé chugat de bharr dearmad, téigh i dteagmháil leis an seoltóir agus scrios an t-ábhar ó do ríomhaire le do thoil.

Re: How to invoke ActionListener for menuitem in XMLMenuModel?

Posted by Matthias Wessendorf <ma...@apache.org>.
Hi,

this should fix it.

https://issues.apache.org/jira/browse/TRINIDAD-1369

will apply the patch soon.

-M

On Tue, Mar 18, 2008 at 8:16 AM, Rottstock, Sven
<Sv...@sungard.de> wrote:
> Hi,
>
> the problem lies in org.apache.myfaces.trinidadinternal.menu.ItemNode. Each item from your menu-metadata.xml is handled by this class. Unfortunately the current implementation does not have an action method that would call your action listener. In other words: IMO it seems to be a bug/missing feature in Trinidad.
>
> Regards,
>
> Sven
>
>
> _______________________________
>
> Think before you print
> CONFIDENTIALITY: This e-mail (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited.  If you receive this e-mail in error, please notify the sender and delete this e-mail from your system.
>
> SunGard CARNOT GmbH * Registered: Frankfurt am Main, Handelsregister Frankfurt HRB 79504 * Geschäftsführer: Harold Finders, Dr. Marc Gille, Dr. Dirk Lüth, Michael J. Ruane, Victoria Elizabeth Silbey
>
>
>
>
>
> ________________________________
>
>        Von: Boyle, PJ [mailto:PJ.Boyle@agriculture.gov.ie]
>        Gesendet: Dienstag, 18. März 2008 16:20
>        Cc: users@myfaces.apache.org
>        Betreff: How to invoke ActionListener for menuitem in XMLMenuModel?
>
>
>
>        Hi,
>
>
>
>        I am trying to get an ActionListener invoked when a menuitem defined in an XMLMenuModel is clicked, I have defined a class
>
>        that implements the ActionListener interface as follows:
>
>
>
>        public class UserMenuSelectActionListener
>
>        {
>
>            public void processAction(ActionEvent actionEvent)
>
>                throws AbortProcessingException
>
>            {
>
>                // the component that triggered the action event
>
>                UIComponent component = actionEvent.getComponent();
>
>                System.out.println("The id of the component that fired the action event: " + component.getId());
>
>
>
>            }
>
>        }
>
>
>
>        I have an itemnode defined in a menu-metadata.xml as follows:
>
>
>
>        <itemNode id="reports" label="#{res.sso_username}" action="UserSearchOutcome" focusViewId="" actionListener="#{'user_menu_select_actionlistener.processAction'}">
>
>
>
>        I have a backing bean defined in faces-config.xml for user_menu_select_actionlistener:
>
>
>
>        <managed-bean>
>
>            <managed-bean-name>user_menu_select_actionlistener</managed-bean-name>
>
>            <managed-bean-class>ie.gov.agriculture.sso.trinidad.UserMenuSelectActionListener</managed-bean-class>
>
>            <managed-bean-scope>application</managed-bean-scope>
>
>        </managed-bean>
>
>
>
>        And finally I have the page where the menu is defined:
>
>
>
>        <tr:navigationPane binding="#{backing_index.navigationPane1}"
>
>        id="navigationPane1" hint="tabs"
>
>        var="foo" value="#{root_menu}"
>
>        level="1">
>
>        <f:facet name="nodeStamp">
>
>        <tr:commandNavigationItem text="#{foo.label}" action="#{foo.doAction}"
>
>        actionListener="#{foo.actionListener }"/>
>
>        </f:facet>
>
>        </tr:navigationPane>
>
>
>
>        When I try to run this I get the following:
>
>
>
>        "javax.faces.el.MethodNotFoundException: processAction: java.lang.String.processAction(javax.faces.event.ActionEvent)"
>
>        Does anybody have any tips on where the problem is please?
>
>        Pj.
>
>
>
>
>
>
>
>
> ________________________________
>
>        Department of Agriculture, Fisheries and Food
>
>        The information contained in this email and in any attachments is confidential and is designated solely for the attention and use of the intended recipient(s). This information may be subject to legal and professional privilege. If you are not an intended recipient of this email, you must not use, disclose, copy, distribute or retain this message or any part of it. If you have received this email in error, please notify the sender immediately and delete all copies of this email from your computer system(s).
>
>        An Roinn Talmhaíochta, Iascaigh agus Bia
>
>        Tá an t-eolais san ríomhphost seo, agus in aon ceangláin leis, faoi phribhléid agus faoi rún agus le h-aghaigh an seolaí amháin. D'fhéadfadh ábhar an seoladh seo bheith faoi phribhléid profisiúnta nó dlíthiúil. Mura tusa an seolaí a bhí beartaithe leis an ríomhphost seo a fháil, tá cosc air, nó aon chuid de, a úsáid, a chóipeál, nó a scaoileadh. Má tháinig sé chugat de bharr dearmad, téigh i dteagmháil leis an seoltóir agus scrios an t-ábhar ó do ríomhaire le do thoil.
>
>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

AW: How to invoke ActionListener for menuitem in XMLMenuModel?

Posted by "Rottstock, Sven" <Sv...@sungard.de>.
Hi,

the problem lies in org.apache.myfaces.trinidadinternal.menu.ItemNode. Each item from your menu-metadata.xml is handled by this class. Unfortunately the current implementation does not have an action method that would call your action listener. In other words: IMO it seems to be a bug/missing feature in Trinidad.

Regards,

Sven


_______________________________

Think before you print
CONFIDENTIALITY: This e-mail (including any attachments) may contain confidential, proprietary and privileged information, and unauthorized disclosure or use is prohibited.  If you receive this e-mail in error, please notify the sender and delete this e-mail from your system.

SunGard CARNOT GmbH * Registered: Frankfurt am Main, Handelsregister Frankfurt HRB 79504 * Geschäftsführer: Harold Finders, Dr. Marc Gille, Dr. Dirk Lüth, Michael J. Ruane, Victoria Elizabeth Silbey





________________________________

	Von: Boyle, PJ [mailto:PJ.Boyle@agriculture.gov.ie] 
	Gesendet: Dienstag, 18. März 2008 16:20
	Cc: users@myfaces.apache.org
	Betreff: How to invoke ActionListener for menuitem in XMLMenuModel?
	
	

	Hi,

	 

	I am trying to get an ActionListener invoked when a menuitem defined in an XMLMenuModel is clicked, I have defined a class

	that implements the ActionListener interface as follows:

	 

	public class UserMenuSelectActionListener

	{

	    public void processAction(ActionEvent actionEvent)

	        throws AbortProcessingException

	    {

	        // the component that triggered the action event 

	        UIComponent component = actionEvent.getComponent();

	        System.out.println("The id of the component that fired the action event: " + component.getId());

	      

	    }

	}

	 

	I have an itemnode defined in a menu-metadata.xml as follows:

	 

	<itemNode id="reports" label="#{res.sso_username}" action="UserSearchOutcome" focusViewId="" actionListener="#{'user_menu_select_actionlistener.processAction'}">

	 

	I have a backing bean defined in faces-config.xml for user_menu_select_actionlistener:

	 

	<managed-bean>

	    <managed-bean-name>user_menu_select_actionlistener</managed-bean-name>

	    <managed-bean-class>ie.gov.agriculture.sso.trinidad.UserMenuSelectActionListener</managed-bean-class>

	    <managed-bean-scope>application</managed-bean-scope>

	</managed-bean>

	 

	And finally I have the page where the menu is defined:

	 

	<tr:navigationPane binding="#{backing_index.navigationPane1}"

	id="navigationPane1" hint="tabs"

	var="foo" value="#{root_menu}"

	level="1">

	<f:facet name="nodeStamp">

	<tr:commandNavigationItem text="#{foo.label}" action="#{foo.doAction}"

	actionListener="#{foo.actionListener }"/>

	</f:facet>

	</tr:navigationPane>

	 

	When I try to run this I get the following:

	 

	"javax.faces.el.MethodNotFoundException: processAction: java.lang.String.processAction(javax.faces.event.ActionEvent)"
	 
	Does anybody have any tips on where the problem is please?
	 
	Pj.

	 

	 

	 


________________________________

	Department of Agriculture, Fisheries and Food
	
	The information contained in this email and in any attachments is confidential and is designated solely for the attention and use of the intended recipient(s). This information may be subject to legal and professional privilege. If you are not an intended recipient of this email, you must not use, disclose, copy, distribute or retain this message or any part of it. If you have received this email in error, please notify the sender immediately and delete all copies of this email from your computer system(s).
	
	An Roinn Talmhaíochta, Iascaigh agus Bia
	
	Tá an t-eolais san ríomhphost seo, agus in aon ceangláin leis, faoi phribhléid agus faoi rún agus le h-aghaigh an seolaí amháin. D'fhéadfadh ábhar an seoladh seo bheith faoi phribhléid profisiúnta nó dlíthiúil. Mura tusa an seolaí a bhí beartaithe leis an ríomhphost seo a fháil, tá cosc air, nó aon chuid de, a úsáid, a chóipeál, nó a scaoileadh. Má tháinig sé chugat de bharr dearmad, téigh i dteagmháil leis an seoltóir agus scrios an t-ábhar ó do ríomhaire le do thoil.