Download The Java™ Web Services Tutorial
Transcript
668
CUSTOM TAGS IN JSP PAGES
public int doStartTag() {
HashMap screens = null;
screens = (HashMap) pageContext.getAttribute("screens",
pageContext.APPLICATION_SCOPE);
if (screens == null)
pageContext.setAttribute("screens", new HashMap(),
pageContext.APPLICATION_SCOPE);
return EVAL_BODY_INCLUDE;
}
The table of screen definitions is filled in by ScreenTag and ParameterTag from
text provided as attributes to these tags. Table 16–6 shows the contents of the
screen definitions hash table for the Duke’s Bookstore application.
Table 16–6 Screen Definitions
Screen Id
Title
Banner
Body
/enter
Duke’s Bookstore
/banner.jsp
/bookstore.jsp
/catalog
Book Catalog
/banner.jsp
/catalog.jsp
/bookdetails
Book Description
/banner.jsp
/bookdetails.jsp
/showcart
Shopping Cart
/banner.jsp
/showcart.jsp
/cashier
Cashier
/banner.jsp
/cashier.jsp
/receipt
Receipt
/banner.jsp
/receipt.jsp
In doEndTag, DefinitionTag creates a public object of class Definition,
selects a screen definition from the screens object based on the URL passed in
the request, and uses it to initialize the Definition object.
public int doEndTag()throws JspTagException {
try {
Definition definition = new Definition();
HashMap screens = null;
ArrayList params = null;
TagSupport screen = null;
screens = (HashMap)
pageContext.getAttribute("screens",
pageContext.APPLICATION_SCOPE);
if (screens != null)
params = (ArrayList) screens.get(screenId);
Related documents
The J2EE™ 1.4 Tutorial
View - ITtestpapers.com
The Java™ Web Services Tutorial
THE J2EE™ 1.4 Tutorial in NetBeans
GridForce - University at Buffalo, Computer Science and
WebLogic Web Service
Guide for protecting boreholes
MIS User Manual (MoW, 2013)
Global - US English
Groundwater Monitoring for Pump Operators
HAZUS MR2 Hurricane User Manual Volume I
[1 ] Oracle® Enterprise Manager