| < Day Day Up > |
|
The <template:insert /> tag is used to retrieve and insert the contents of the named URI. The <template:insert /> tag acts as the parent to one or more <template:put /> tags, which act as parameters to the named template JSP. The <template:insert /> tag has a body type of JSP and a single required attribute template that names the URI of the resource to include as the template. A sample code snippet using the <template:insert /> tag is shown here:
<%@ taglib uri="/WEB-INF/tlds/struts-template.tld" prefix="template" %> <template:insert template="/catalogTemplate.jsp"> <template:put name="navbar" content="/navbar.jsp" /> <template:put name="header" content="/header.jsp" /> <template:put name="body" content="/login.jsp" /> <template:put name="footer" content="/footer.html" /> </template:insert>
This instance of the <template:insert /> tag will set four request attributes to the values of their content attributes, which in this case are a combination of JSPs and a single HTML document.
The content attributes in this example could just as easily have been a static string that could be stored as the value in the request attribute.
| < Day Day Up > |
|