Frameworks| Hibernate| Struts| JSF| JavaFX| Ajax| Spring| DOJO| JDO| iBatis| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
Tomahawk radio tag 
 

This component is used when selectOneRadio component takes the value "spread" for "layout" attribute.

 

Tomahawk radio tag

                          

This component is used when selectOneRadio component takes the value "spread" for "layout" attribute. Using this tag we can position the radio button anywhere in the document. Its "for" attribute is used to specify the id for selectOneRadio component and "index" attribute is used to specify which selectItem value is to be displayed. Here "0" value for index attribute is used to select the first selectItem value. This all can be understood from the following example:


Code Description : 

 

 

 

 

 

 

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>

<f:view>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
          charset=iso-8859-1">
  <title>t:radio example</title>
  <style type="text/css">
    <!--
    body{
      background-color:#fff2f2;
      margin-top:30;
    }
    -->
 </style>
 </head>
 <body >
   <h:form><center>
      <t:selectOneRadio id="sor" value="SI" layout="spread"
                        border="1"
                        style="font-weight:bold;
                               background-color:#99CCFF;">
	 <f:selectItem id="si1" itemLabel="Samsung" itemValue="sa" />
         <f:selectItem id="si2" itemLabel="Link" itemValue="lo" />
	 <f:selectItem id="si3" itemLabel="Logitech" itemValue="lg" />
	 <f:selectItem id="si4" itemLabel="BenQ" itemValue="bq" />		
      </t:selectOneRadio>
      
      <t:panelGrid columns="1" width="20%" style="color:green;"
                               cellpadding="0" cellspacing="5">
        
        <t:panelGroup>
            <t:radio for="sor" index="0"></t:radio>
            <t:inputText />
	</t:panelGroup>
	<f:verbatim><hr></f:verbatim>
	<t:panelGroup>
            <t:radio for="sor" index="1"></t:radio>
            <t:inputText />
	</t:panelGroup>
	<f:verbatim><hr></f:verbatim>

	<t:panelGroup>
            <t:radio for="sor" index="2"></t:radio>
            <t:inputText />
	</t:panelGroup>
	<f:verbatim><hr></f:verbatim>

	<t:panelGroup>
            <t:radio for="sor" index="3"></t:radio>
            <t:inputText />
	</t:panelGroup>

      </t:panelGrid>
</center></h:form>
</body>
</html>
</f:view>

Rendered Output :

 Html Source Code :

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html;
          charset=iso-8859-1">
    <title>t:radio example</title>
    <style type="text/css">
     <!--
       body{
         background-color:#fff2f2;
         margin-top:30;
       }
    -->
    </style>
  </head>
  <body >
     <form id="_idJsp0" name="_idJsp0" method="post"
           action="/tomahawk_tags/pages/radio.jsf"
           enctype="application/x-www-form-urlencoded">
      <center>
	<table cellpadding="0" cellspacing="5" width="20%"
               style="color:green;">
          <tbody>
            <tr>
              <td>
                <label>
                   <input type="radio" name="_idJsp0:sor" 
                          value="sa"
                          style="font-weight:bold;
                          background-color:#99CCFF;" />
                   &#160;Samsung
                </label>
                <input id="_idJsp0:_idJsp4" 
                       name="_idJsp0:_idJsp4"
                       type="text" value="" />
              </td>
            </tr>
            <tr>
              <td><hr></td>
            </tr>
            <tr>
              <td>
                <label>
                   <input type="radio" name="_idJsp0:sor"
                          value="lo"
                          style="font-weight:bold;
                          background-color:#99CCFF;" />
                  &#160;Link
                </label>
                <input id="_idJsp0:_idJsp8"
                       name="_idJsp0:_idJsp8"
                       type="text" value="" />
              </td>
            </tr>
            <tr>
              <td><hr></td>
            </tr>
            <tr>
              <td>
                 <label>
                   <input type="radio" name="_idJsp0:sor"
                          value="lg"
                          style="font-weight:bold;
                          background-color:#99CCFF;" />
                   &#160;Logitech
                </label>
                <input id="_idJsp0:_idJsp12"
                       name="_idJsp0:_idJsp12"
                       type="text" value="" />
              </td>
            </tr>
            <tr>
              <td><hr></td>
            </tr>
            <tr>
              <td>
                <label>
                   <input type="radio" name="_idJsp0:sor"
                          value="bq"
                          style="font-weight:bold;
                          background-color:#99CCFF;" />
                   &#160;BenQ
                </label>
                <input id="_idJsp0:_idJsp16"
                       name="_idJsp0:_idJsp16"
                       type="text" value="" />
              </td>
            </tr>
          </tbody>
       </table>
</center>
<input type="hidden" name="_idJsp0_SUBMIT" value="1" />
<input type="hidden" name="javax.faces.ViewState" 
       id="javax.faces.ViewState" 
       value="rO0ABXVyABNbTGphdmEubGFuZy5PYmplY3Q7kM5Ynx
BzKWwCAAB4cAAAAAN0AAMxODdwdAAQL3BhZ2VzL3JhZGlvLmpzcA==" />
</form>
<!-- MYFACES JAVASCRIPT -->
</body>
</html>

This tag contains attributes given below :

  • id : This is the value which is used to uniquely identify the component within the closest container like form or subview. The main thing to remember is that its value must be a static value.
  • binding : This attribute is used to specify the property of the backing bean with which this component instance is to be bound.
  • rendered : Its default value is true. If  this attribute is set to true then this component is presented in the page to the user. If false, then this component is not rendered.
  • enabledOnUserRole : If the current user has one of the roles listed in the enabledOnUserRole attribute then enabling or disabling of the component is decided on the base of "disabled" attribute. If disabled attribute is set to true then component is disabled otherwise enabled. If the user is not in the above list then the component is rendered disabled.
  • visibleOnUserRole : If the current user has one of the roles listed in the visibleOnUserRole attribute then processing of the component is decided on the base of "rendered" attribute. If the rendered attribute is set to true then component is not rendered otherwise displayed  on the page. On the other hand if the current user is not in the above list then the component is not processed.
  • for : This attribute takes the id of the referenced selectOneRadio component.
  • index : This attribute is used to reference the corresponding selectItem where "0" is used to reference the first selectItem and so on.

                          

» View all related tutorials
Related Tags: html tag this element render img e im ml m nt em end me s htm is s s ren

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.