This section illustrates more about commandButton tag in JSF. This tag renders an HTML submit button. This button can be associated with bean. You can perform any operations at particular event by associating actionListener class for event handling. You can do any thing with JSF component by the external resources like showing message from the message bundle and handling form data after submission the form by backing bean.
This section also providing a program with complete code which display a command button inside a form. When you will click on the button, it's action attributes send a value "page1" to the faces-config.xml file where navigation has been made with the "page1" value. And the navigation refers the control to the Index page.
HTML Source Code:
<html> <head><title>jsf h:commandButton example</title></head> <body> <form id="_id0" method="post" action="/ h-tags/pages/commandButton/commandButton.jsf" enctype="application /x-www-form-urlencoded"> <input type="submit" name="_id0:_id1" value="Go To Index Page." /> <input type="hidden" name="_id0" value="_id0" /> </form> </body> </html>
JSF commandButton tag has some attribute for different purposes. These attributes are explained below:
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.