📄 abstractbodytag.java
字号:
/**
*
* $Header: /raid1/wide/cvsroot/wide/dev/struts/struts-metadata/templates/new-app/nitroX-tour/site/WEB-INF/src/java/com/hp/mw/samples/struts/storefront/taglibs/AbstractBodyTag.java,v 1.1 2005/10/10 20:12:04 sami Exp $
*
* Copyright (c) 2002 by M7 Corporation
* All rights reserved.
*
* The information contained herein is confidential and proprietary
* to M7 Corporation, and considered a trade secret as defined under
* civil and criminal statutes. M7 Corporation shall pursue its
* civil and criminal remedies in the event of unauthorized use or
* misappropriation of its trade secrets. Use of this information
* by anyone other than authorized employees of M7 Corporation is
* granted only under a written non-disclosure agreement, expressly
* prescribing the scope and manner of such use.
*
*/
package com.hp.mw.samples.struts.storefront.taglibs;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
/**
*
* @author <a href="mailto:zcollier@m7.com">Zaitrarrio Collier</a>
* @version $ Revision: $
*/
public class AbstractBodyTag
extends BodyTagSupport
{
/**
* Default value for <code>serialVersionUID</code> required for Serializable class
*/
private static final long serialVersionUID = 1L;
//~ Instance fields --------------------------------------------------------
// tracks whether an exception has occurred while handling this page
private boolean errors = false;
//~ Methods ----------------------------------------------------------------
/**
* @see javax.servlet.jsp.tagext.BodyTag
*/
public int doStartTag( )
throws JspException
{
try
{
pageContext.getOut( ).write( getTagContent( ) );
}
catch ( Exception e )
{
handlePageException( e );
}
return SKIP_BODY;
}
/**
* @see javax.servlet.jsp.tagext.BodyTag
*/
public int doEndTag( )
throws JspException
{
return errors
? SKIP_PAGE
: EVAL_PAGE;
}
/**
* method for returning the content of the tag, overridden by subclasses
*
* @return the output content for the tag
*/
public String getTagContent( )
{
return "";
}
/**
* Handles exceptions which may occur while processing the page
*
* @param the exception that should be handled
* @see javax.servlet.jsp.PageContext
*/
public void handlePageException( Exception e )
throws JspException
{
try
{
errors = true;
pageContext.getRequest( ).setAttribute( "javax.servlet.jsp.jspException", e );
pageContext.handlePageException( e );
}
catch ( Exception ne )
{
throw new JspException( ne.getMessage( ) );
}
}
/**
* Returns an http session from the servlet request
*
* @return the current http session
*/
protected final HttpSession getSession( boolean create )
{
HttpServletRequest request = ( HttpServletRequest ) pageContext.getRequest( );
return request.getSession( create );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -