• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

AddActionListener programatically

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in jsf I can write something like this:

<af:commandLink text="Save"
actionListener="#{pageFlowScope.myBean.saveMethod}"
id="save">
<af:setActionListener from="#{student.id}" to="#{pageFlowScope.myBean.id}"/>
<af:setActionListener from="#{student.name}" to="#{pageFlowScope.myBean.name}"/>
</af:commandLink>

I need to generate this kind of code programmitically. it generate multiple save links.

Now I can write programmitically like:

RichCommandLink saveLink = new RichCommandLink();
MethodExpression mbForSave =
facesContext.getApplication().getExpressionFactory().createMethodExpression(facesContext.getELContext(),
"#{pageFlowScope.myBean.saveMethod}",
null,
new Class[] { ActionEvent.class });
saveLink.addActionListener(new MethodExpressionActionListener(mbForSave));


but how to set from and to parameters programmitically?
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic