This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of React Cookbook: Recipes for Mastering the React Framework and have David Griffiths & Dawn Griffiths on-line!
See this thread for details.
Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

what is differences between action and actionlistener in JSF components?

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
can some one tell me what is differences between action and actionlistener in JSF components ?
for example an command button has action and ActionListener properties ,
what is differences between them , when we should use each of them ?
 
author
Posts: 62
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is covered in chapter 8 - the Faces event model.

Basically the "action" attribute refers to an action method which returns a String from which the Faces navigation model can use to decide whether or not a navigation is necessary based on the value of the string.

typically one uses an action method to execute some code after a button or link is clicked and then possibly navigate based on the outcome of executed code.

An actionlistener method compared to an action method does not return a String. Instead it returns void. It is basically identical to the action method but instead it just executes the code after an action event (button click or link click) but a navigation is not needed.

A good example of actionlistener could be in response to clicking on a checkbox and having the actionlistener code behind it change a visual attribute of a page such as render a component that was not rendered before..

Chapter 8 has exactly this example where I show how you can have a checkbox when clicked render an additional field in an input form.

-Chris
 
I'm gonna teach you a lesson! Start by looking at this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic