JSF inputHidden tag example
1). JSF inputHidden tag Program Structure:
2). index.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<html>
<head>
<title>JSF inputHidden tag example!</title>
<script type="text/javascript">
function showHiddenValue(){
alert(document.getElementById('jsfinputHiddenForm:hiddenField').value);
}
</script>
</head>
<body>
<f:view>
<h1>JSF h:inputHidden tag </h1>
<h:form id="jsfinputHiddenForm">
<h3>Get value from inputHidden field</h3>
<h:inputHidden value="Hello JSF World" id="hiddenField" />
<h:commandButton value="Click me to show Hidden Value" onclick="showHiddenValue()" />
</h:form>
</f:view>
</body>
</html>
3). OutPut
No comments:
Post a Comment