wood burning stoves 2.0*
The moose likes JSF and the fly likes How do i capture HtmlCommandButton click Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "How do i capture HtmlCommandButton click" Watch "How do i capture HtmlCommandButton click" New topic
Author

How do i capture HtmlCommandButton click

Rani Subramani
Greenhorn

Joined: Jan 16, 2009
Posts: 7
I am developing a custom component which renderes the HtmlCommandButton. I need to perform some logic on click of the button.
How do i capture whether the HtmlCommandButton is clicked or not using the button object in my java class

HtmlCommandButton button = (HtmlCommandButton) FacesContext
.getCurrentInstance().getApplication().createComponent(
HtmlCommandButton.COMPONENT_TYPE);



Thanks
Rani
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Set the action expression.
Rani Subramani
Greenhorn

Joined: Jan 16, 2009
Posts: 7
but setAction() method is deprecated...
Pari Gandhi
Greenhorn

Joined: Feb 26, 2009
Posts: 10
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Rani Subramani wrote:but setAction() method is deprecated...

Deprecation is always explained in the javadocs. Learn to find, read and understand the javadocs. Don't underestimate them.
http://java.sun.com/javaee/5/docs/api/javax/faces/component/UICommand.html#setAction(javax.faces.el.MethodBinding)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How do i capture HtmlCommandButton click
 
Similar Threads
How to redirect to any other portlet on clicking Normal or Maximized icon of portlet
How to Capture a Tab Click on JTabbedPane
How to use CommandLink in custom component?
Disabling h:commandButtons in d:dataTables
Capture Mouse Events on JTable