This tag is used to create the component
which displays the list of countries in selection box according to the
locale.
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:selectOneCountry example</title>
<style type="text/css">
<!--
body{
background-color:#fff2f2;
margin-top:30;
}
-->
</style>
</head>
<body >
<h:form><center>
<t:panelGrid columns="2" style="font-weight:bold;">
<t:outputLabel for="name" value="Name" />
<t:inputText id="name"/>
<t:outputLabel for="phone" value="Phone No." />
<t:inputText id="phone"/>
<t:outputLabel for="country" value="Country" />
<t:selectOneCountry id="country" maxLength="16"
emptySelection="Select Country"/>
</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:selectOneCountry 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/selectOneCountry.jsf;
jsessionid=758E2FAD7C199D722DA8B5E243E0E27D"
enctype="application/x-www-form-urlencoded">
<center>
<table style="font-weight:bold;">
<tbody><tr><td>
<label for="_idJsp0:name">Name</label>
</td><td>
<input id="_idJsp0:name" name="_idJsp0:name" type="text" value="" />
</td></tr>
<tr><td>
<label for="_idJsp0:phone">Phone No.</label>
</td><td>
<input id="_idJsp0:phone" name="_idJsp0:phone" type="text" value="" />
</td></tr>
<tr><td>
<label for="_idJsp0:country">Country</label>
</td><td>
<select id="_idJsp0:country" name="_idJsp0:country" size="1">
<option value="" selected="selected">Select Country</option>
<option value="AF">Afghanistan</option>
<option value="AL">Albania</option>
<option value="DZ">Algeria</option>
<option value="AS">American Samoa</option>
<option value="AD">Andorra</option>
<option value="AO">Angola</option>
<option value="AI">Anguilla</option>
<option value="AQ">Antarctica</option>
<option value="AG">Antigua and B...</option>
<option value="AR">Argentina</option>
<option value="AM">Armenia</option>
<option value="AW">Aruba</option>
<option value="AU">Australia</option>
<option value="AT">Austria</option>
<option value="AZ">Azerbaijan</option>
<option value="BS">Bahamas</option>
...................
...................
</select>
</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="rO0ABXVyABNbTGphdmEubGFuZy5PYm
plY3Q7kM5YnxBzKWwCAAB4cAAAAAN0AAExcHQAGy9wYWdlcy9zZWxlY3RPbmVDb3
VudHJ5LmpzcA==" /></form>
<!-- MYFACES JAVASCRIPT -->
</body>
</html>
|
This tag contains attributes given below :
|
Recommend the tutorial |
Ask Questions? Discuss: Tomahawk selectOneCountry tag View All Comments
Post your Comment