Skip to content

Instantly share code, notes, and snippets.

@jyeary
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jyeary/5adbeaf898a2e9bb939d to your computer and use it in GitHub Desktop.
Save jyeary/5adbeaf898a2e9bb939d to your computer and use it in GitHub Desktop.
An example of how to use the p:passthrough functionality in JSF 2.2
<?xml version='1.0' encoding='UTF-8' ?>
<!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://xmlns.jcp.org/jsf/html"
xmlns:p="http://xmlns.jcp.org/jsf/passthrough">
<h:head>
<title>&lt;p:passthrough/&gt; example</title>
</h:head>
<h:body>
<h:panelGroup id="panelGroup1" layout="block"
p:onmouseover="this.setAttribute('style', 'color: blue; font-size:32px; font-weight:bolder;');"
p:onmouseout="this.setAttribute('style', 'color: black; font-size:inherit; font-weight:normal;');">
<h:outputText id="outputText1" value="Click me!"
p:data-experimental-type="Hello World!"
p:style="font-variant:small-caps;"
p:onclick="alert(this.getAttribute('data-experimental-type'));"/>
</h:panelGroup>
</h:body>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="j_idt2">
<title>&lt;p:passthrough/&gt; example</title>
</head>
<body>
<h1>&lt;p:passthrough/&gt; example</h1>
<div id="panelGroup1"
onmouseout="this.setAttribute('style', 'color: black; font-size:inherit; font-weight:normal;');"
onmouseover="this.setAttribute('style', 'color: blue; font-size:32px; font-weight:bolder;');">
<span id="outputText1" onclick="alert(this.getAttribute('data-experimental-type'));"
data-experimental-type="Hello World!"
style="font-variant:small-caps;">Click me!</span>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment