is there a way to get the word the mouse is over on by using AJAX on JSF 2.0 (which even works on outputText component)?
My goal is to store that word on a bean variable (let's say #{bean.selectedWord}) to use for further operations.
Up to now I'm only able to get the entire value of the inputText element... I was wondering if I had to use jQuery too.
page.xhtml
<h:inputText id = "myIinput" value="this is a test">
<f:ajax event="mouseover" render="myOutput" execute="myInput"
listener="#{bean.ajaxFunction}"/>
</h:inputText>
<h:outputText id ="myOutput" value="#{bean.selectedWord}" />
bean.java
String selectedWord;
public void ajaxFunction(AjaxBehaviorEvent event) {
UIComponent uic = event.getComponent();
String output = (String) uic.getAttributes().get("value");
myOutput = output ;
}
public String getSelectedWord(){
return selectedWord
}