This section explains you creating checkbox by JSF tag. selectBooleanCheckbox tag is used to create checkbox. This tag renders an html "input" tag whose type is set to "checkbox" and "name" is set to "id". If the "value" of this component is set to "true" then a checked checkbox is rendered. This is used when we want to give an option to the user to select or deselect.
Code Description :
|<%@ taglib uri="http://java.sun.com/jsf/html"
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<h:selectBooleanCheckbox id="checkbox" value="true"
title="click it to select or deselect"/>
<h:outputText value="Want to participate?"/>
Rendered Output : In the above code value is set to true so checkbox is rendered as checked. On moving the mouse pointer to the chenkbox element a tooltip pops up that is the text written in title attribute.
Html Source Code :
<form id="_id0" method="post" action="/htmltag/pages
<input id="_id0:checkbox" type="checkbox"
name="_id0:checkbox" checked title="click it to select or
Want to participate?
<input type="hidden" name="_id0" value="_id0" />
This tag contains some attributes that are described below :
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.