Found the answer:

MethodBinding mb = new SimpleActionMethodBinding(action) - action will
be the string  - essentially the outcome.



________________________________

From: Madhav Bhargava [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 10, 2007 6:54 PM
To: MyFaces Discussion
Subject: how to programmatically setAction for any command component



Hi All,

 It is easy to set the action for a ActionSource component when the
action name is a valueReference pointing to a method. Following code
will do it:

 if (UIComponentTag.isValueReference (action)) {

            ((ActionSource) component).setAction(FacesContext


.getCurrentInstance().getApplication().createMethodBinding(

                                    action, new Class[] {}));

}

 The problem that I am facing is that I have a HtmlCommandNavigationItem
which extends org.apache.myfaces.component.html.ext.HtmlCommandLink

 I need to do something like:

<t:commandNavigation2 id="id5_1" action="changepassword">

            <h:outputText value="#{msg['nav.changepassword']}" />

</t:commandNavigation2>

 Here the action attribute is set to a string which is not a method
name. This string is defined as an outcome in faces-config.xml. I need
to set this action attribute programmatically but the only method
available is setAction(MethodBinding mb)

 Since this string is not a method I cannot use this method. I could not
find any other way to handle this.

 Does anyone know how to set the action attribute to a string which is
not a method programmatically?

 Rgds,

Madhav



--
When I tell the truth, it is not for the sake of convincing those who do
not know it, but for the sake of defending those that do



**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely 
for the use of the addressee(s). If you are not the intended recipient, please 
notify the sender by e-mail and delete the original message. Further, you are 
not to copy, disclose, or distribute this e-mail or its contents to any other 
person and any such actions are unlawful. This e-mail may contain viruses. 
Infosys has taken every reasonable precaution to minimize this risk, but is not 
liable for any damage you may sustain as a result of any virus in this e-mail. 
You should carry out your own virus checks before opening the e-mail or 
attachment. Infosys reserves the right to monitor and review the content of all 
messages sent to or from this e-mail address. Messages sent to or from this 
e-mail address may be stored on the Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***

Reply via email to