<button> with JSF 1.2

Simple question:

Is there a way to render an html <button> element using JSF or any other structure (RichFaces, Tomahawk, etc.)? Or would I resort to writing a custom component for this?

+4
source share
1 answer

No no. Since <button> usually only used in GET requests, you can also just put it in the JSF template with plain vanilla. In any case, you do not need to bind any action to the JSF managed bean.

In JSF 2.0, there is, by the way, <h:button> , which displays the GET button and offers the ability to include presentation options and / or to perform implicit navigation. Both functions are not available in JSF 1.2, so it really makes no sense to have a similar component in JSF 1.2.

On the other hand, if you really intend to use <button> to invoke a POST-based bean action method, then you really should use <h:commandButton> . If you have certain problems with it, for which you thought that using <button> was a solution, then you will need to reconsider your question to talk more about this specific problem so that we can answer how to achieve the same with <h:commandButton> .

0
source