Magazine
 
Tomahawk Tags
 
3. Tomahawk documentBody tag
This tag is used to encapsulate the body of the document. It is equivalent to the HTML <body> tag. We can use this tag in place of <body> tag in our JSP page. It has one attribute “state” that is used to specify the state stored by this component.

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>
<t:document>
<t:documentHead>
<meta http-equiv=”Content-Type”
content=”text/html; charset=iso-8859-1">
<title>t:documentBody example</title>
</t:documentHead>
<t:documentBody >
<h:form>
<t:outputText value=”The documentBody tag
is equivalent to HTML <body> tag.”/>
</h:form>
</t:documentBody>
</t:document>
</f:view>

  4. Tomahawk saveState tag
This tag is useful in persisting the backing bean and its properties longer than request scope but shorter than session scope by saving the state with the component tree. Traditionally, state is saved with the help of HttpSession object. MyFaces works differently without the use of HttpSession object. All state information of the current view and the model beans are encoded automatically with the client response and get restored at the next client request. If you want to save the whole bean then it can also be done with this tag just specifying the name of bean in EL expression in the value attribute. Same steps are followed in saving and restoring the whole bean as in the case of properties of bean. If you want the value of a bean property or the bean itself to be able to get saved and restored, it must implement the Serializable interface.

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>
<t:document>
<t:documentHead>
<meta http-equiv=”Content-Type”
content=”text/html; charset=iso-8859-1">

Nov 2007 | Java Jazz Up |24
 
previous
index
next
 
View All Topics
All Pages of this Issue
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   Download PDF