K
Ken
I am trying to follow a sun tutorial for creating custom tags. (The
tutorial can be found here if needed: http://java.sun.com/products/jsp/tutorial/TagLibraries16.html
)
The issue:
The documentation here (http://java.sun.com/products/jsp/tags/11/
syntaxref11.fm10.html) states that I _must_ create or locate a bean
with <jsp:useBean> before I use <jsp:getProperty> on that bean. Now
in the Sun example the <jsp:getProperty> is not referencing the bean
from <jsp:useBean> but one from a custom tag.
If this is possible what requirements need to fulfilled so I can make
sure I am fulfilling them? I have done quite a bit of normal Java
programming but having just started with JSPs I'm finding the new
functionality magical.
Hopefully I've provided information but should you need a concrete
example:
========= START EXAMPLE =========
<%--
Document : list.jsp
Created on : 28-Oct-2009, 1:16:43 PM
Author : ken
--%>
<%@ taglib uri="/WEB-INF/tlds/kentld.tld" prefix="tlt" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<jsp:useBean id="org" class="businessLogic.Organization"/>
<%
String deptName = (String) request.getParameter("deptName");
businessLogic.Department dept = org.getDepartment(deptName);
%>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title><%= deptName %></title>
</head>
<body>
<table>
<tr>
<th width="100">Name</th>
</tr>
<%-- List all department members --%>
<tlt:IterationTag name="member"
type="businessLogic.Member"
group="<%= dept.getMembers() %>">
<tr>
</tlt:IterationTag>
</table>
</body>
</html>
========= END EXAMPLE =========
tutorial can be found here if needed: http://java.sun.com/products/jsp/tutorial/TagLibraries16.html
)
The issue:
The documentation here (http://java.sun.com/products/jsp/tags/11/
syntaxref11.fm10.html) states that I _must_ create or locate a bean
with <jsp:useBean> before I use <jsp:getProperty> on that bean. Now
in the Sun example the <jsp:getProperty> is not referencing the bean
from <jsp:useBean> but one from a custom tag.
If this is possible what requirements need to fulfilled so I can make
sure I am fulfilling them? I have done quite a bit of normal Java
programming but having just started with JSPs I'm finding the new
functionality magical.
Hopefully I've provided information but should you need a concrete
example:
========= START EXAMPLE =========
<%--
Document : list.jsp
Created on : 28-Oct-2009, 1:16:43 PM
Author : ken
--%>
<%@ taglib uri="/WEB-INF/tlds/kentld.tld" prefix="tlt" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<jsp:useBean id="org" class="businessLogic.Organization"/>
<%
String deptName = (String) request.getParameter("deptName");
businessLogic.Department dept = org.getDepartment(deptName);
%>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title><%= deptName %></title>
</head>
<body>
<table>
<tr>
<th width="100">Name</th>
</tr>
<%-- List all department members --%>
<tlt:IterationTag name="member"
type="businessLogic.Member"
group="<%= dept.getMembers() %>">
<tr>
</tr>said:</td>
</tlt:IterationTag>
</table>
</body>
</html>
========= END EXAMPLE =========