Magazine
 
Tomahawk Tags

Tomahawk tags are collection of standard components with extended functionality and many more extra set of components with rich set of functionality.

1-Tomahawk inputTextHelp tag

This tag creates an input text box but it has extra ability to select or removing the text displayed. This text is used to help the user and is set by “helpText” attribute. The capability of disappearing or selecting the text is provided by “selectText” attribute of the tag. This tag has additional feature of displaying value only, not the widget of the box. This component also has ability to be visible or not visible according to the role of the user. In the same way, it also has the ability to be enabled or disabled according to the user role. Normally the naming system of JSF renders the id for the component with some additional text, typically with id of the form, as prefix. But this component has an attribute forceId, which forces the component to render the same id mentioned in the id attribute.

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:inputTextHelp example</title>
<style type=”text/css”>
<!—
body{
background-color:#fff2f2;
margin-top:30;
}
.inputstyle{
background-color:#99CCFF;
}
—>
</style>
</head>

 

<body ><center>
<t:inputTextHelp id=”ith1" value=””
helpText=”Hello....”
style=”color:#0033CC; font-weight:bold”
styleClass=”inputstyle” title=”inputTextHelp
example 1" /><p>
<t:inputTextHelp id=”ith2" value=””
helpText=”How are you?” selectText=”true”
style=”color:#0033CC; font-weight:bold”
styleClass=”inputstyle” title=”inputTextHelp
example 2" />
</center></body>
</html>
</f:view>

Rendered Output:

This is the output of the page. In this Hello.... and How are you? texts are the texts specified in the helpText attribute of the tag.

If we take focus on the first component then text in the component disappears while in the other whole text is selected because of setting the selectText attribute to true in the second component.

Oct 2007 | Java Jazz Up | 35
 
previous
index
next
 
Pages: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,

30
, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53 , 54, 55, 56, 57,

58
, 59, 60, 61, 62, 63 , 64, 65 , 66 , 67 , 68 , 69 , 70, 71, 72, 73, 74, 75, 76, 77, 78,   Download PDF