I wish to extend the following element:
<h:commandButton action="#{menuController.xyz}" value="xyz"
image="images/buttons/xyz.png" alt="xyz".....[more attributes]..../>
to include code to produce a depressed button:
<h:commandButton action="#{menuController.xyz}" value="xyz"
image="images/buttons/xyz.png" alt="xyz"
onmousedown="[some JS here to change image src]"
.....[more attributes]..../>
I understand the neatest way to do this is with a JSF component? So I created the following:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:composite="http://java.sun.com/jsf/composite">
<head>
<title>Not present in rendered output</title>
</head>
<body>
<composite:interface>
<composite:attribute name="depressImage" required="false" />
</composite:interface>
<composite:implementation>
<h:commandButton onmousedown="[some JS here to change the img src to the value of #{cc.attrs.depressImage}]" />
</composite:implementation>
</body>
</html>
My question is, without having to type all the possible attruibutes and map the EL is there a way to populate them automatically (for example the command button action and value etc.)?