This section is in concern with discussing about "selectOneRadio" tag. This allows the user to select one option from a set of available options. It renders a table which contains "input" elements of type "radio". It renders such a list of options where if you select any other option the previous selection gets automatically deselected. This tag supports two layout "lineDirection" and "pageDirection" for horizontal and vertical .layout determines whether the chenkboxes are laid out horizontally or vertically. lineDirection is the default layout. f:selectItem or f:selectItems are used to provide a list of available options.
Code Description :
| <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%> <f:view> <html> <body> <h:form> <h:selectOneRadio id="sor" value="TableBean.perInfoAll" title="Select any one of the choice" layout="pageDirection" border="1"> <f:selectItem id="si1" itemLabel="Thums Up" itemValue="11" /> <f:selectItem id="si2" itemLabel="Limca" itemValue="22" /> <f:selectItem id="si3" itemLabel="Pepsi" itemValue="33" /> <f:selectItem id="si4" itemLabel="Sprite" itemValue="44" /> <f:selectItem id="si5" itemLabel="Frooti" itemValue="55" /> <f:selectItem id="si6" itemLabel="Coca-Cola" itemValue="66" /> </h:selectOneRadio> </h:form> </body> </html> </f:view> |
Rendered Output :

Html Source Code:
|
<html> |
All the attributes of this tag have been summarized 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.
Ask Questions? Discuss: JSF selectOneRadio Tag
Post your Comment