This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

ActionListener  RSS feed

 
Servo Alvo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Suppose this java bean´s method:



and suppose it´s referenced in the "actionListener" attribute on an UI Input.

So every time I call a method on "actionListener" attrib, does the container passess two params to the method, namely FacesContext and UIInput ?

Thanks in advance!


 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The signatures for JSF methods are not user-definable. They're determined by the JSF standard.

However, the proper way to get the FacesContext isn't via a parameter, anyway. Use "FacesContext.getCurrentContext()".
 
Servo Alvo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry dude but I couldn´t understand the purpose of FacesContext ! I´ve read many many sources but I´m still confused with it.

Does it work like scope variable context for JSP or Servletcontext for Servlets ?

Should I obtain the faces context (only) in a java bean method like this:



Can the servlet contex object be obtained from the fc ?

Can you if possible explain it with an example please?

Please don´t forget I´m still a newbie.

Thanks in advance!
 
Tim Holloway
Bartender
Posts: 18713
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I generally define a JSFUtils class so that I can keep as much JSF-specific code as I can out of the general logic. I haven't had occasion to get the ServletContext, but here's a sample that gets the Request object:
 
Servo Alvo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And then you call those utils methods in the java beans?

Does the ServletContext come from the same object ?

Thanks!
 
Servo Alvo
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Up...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!