In html / JSF - How to make a component respond to clicks?

I replaced the content of this question because I did not think that the previous one was formulated correctly.

I would like to know how to make JSF / RichFaces a component for handling events like mouse click / hover etc.

The goal is to create beautiful large buttons that respond to mouseover and mouse clicks.

Thank!

+3
source share
2 answers

All (visual) components have attributes such as onclick, onmouseover, onmouseout, onfocusetc., which allow to run Javascript code when running a specific event. For example:

<h:inputText ... onclick="alert('Click');"/>

"Click", .

, - :

<h:commandButton ... styleClass="aCssClass" onmouseover="this.className='anotherCssClass'" onmouseout="this.className='aCssClass'"/>

CSS aCssClass, , anotherCssClass. , CSS onclick...

: Ajax , , , <a4j:support/>:

<h:inputText ...>
    <a4j:support event="onclick" actionListener="#{myBean.doSomething}"/>
</h:inputText>
+2

, , , , .

URL . " ", , , . JSF, " ".

0

Source: https://habr.com/ru/post/1731242/


All Articles