bannerimgtag.java
来自「《Java网络程序设计.rar》包括三个网络程序的源代码。」· Java 代码 · 共 45 行
JAVA
45 行
package org.impact.stars.taglib.banner;import javax.servlet.jsp.*;import javax.servlet.jsp.tagext.*;import java.io.IOException;import org.impact.stars.control.web.ProfileMgrWebImpl;import org.impact.stars.organizationmd.profilemgr.model.ExplicitInformation;import org.impact.stars.util.Debug;/* * BannerImgTag * ------------ * This tag, which should be nested inside a banner tag, retrieves the banner * url from the outer banner tag and prints out the url to the JSP page. See * BannerTag.java for an example of how to use this tag. An exception is * thrown if the tag is not inside a banner tag. */public class BannerImgTag extends TagSupport { public int doStartTag() throws JspTagException { // check if bannerImg tag is inside banner tag BannerTag bannerTag = (BannerTag) findAncestorWithClass(this, BannerTag.class); if (bannerTag == null) { throw new JspTagException("BannerImgTag: bannerImg tag not inside" + "banner tag"); } // print out url try { JspWriter out = pageContext.getOut(); out.print(bannerTag.getBannerString()); } catch(IOException ioe) { Debug.println("BannerImgTag: Error printing banner image url: " + ioe); } // there should be no body to process return(SKIP_BODY); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?