六月婷婷综合激情-六月婷婷综合-六月婷婷在线观看-六月婷婷在线-亚洲黄色在线网站-亚洲黄色在线观看网站

明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

JSP中的TagLib應用(4-1)

[摘要]下面到了關鍵部分樂。 對tag進行處理。其實很多情況下我們是使用已經提供的taglib.別人/公司已經做好了tag和處理部分,打好了包 我們需要做的只是在我們的jsp中去應用.但是當我們自己做個taglib時, 就需要編寫這部分tag handler了. 這里只針對上面文件里提到的insert t...
下面到了關鍵部分樂。 對tag進行處理。其實很多情況下我們是使用已經提供的taglib.

別人/公司已經做好了tag和處理部分,打好了包 我們需要做的只是在我們的jsp中去應用.

但是當我們自己做個taglib時, 就需要編寫這部分tag handler了.

這里只針對上面文件里提到的insert tag,其他的為了避免重復,就不一一說明了

==================== InsertTag.java==============================

/*

* $Id: InsertTag.java,v 1.13 2000/03/04 02:54:57 brydon Exp $

* Copyright 1999 Sun Microsystems, Inc. All rights reserved.

* Copyright 1999 Sun Microsystems, Inc. Tous droits réservés.

*/

package com.sun.estore.taglib;

import javax.servlet.jsp.JspTagException;

import javax.servlet.jsp.tagext.TagSupport;

import com.sun.estore.util.Debug;

/**

* This class is an easy interface to the JSP template or other

* text that needs to be inserted.

* @author Greg Murray

*/

public class InsertTag extends TagSupport {

private boolean directInclude = false;

private String parameter = null;

private String templateName = null;

private Template template = null;

private TemplateParameter templateParam = null;

/**

* default constructor

*/

public InsertTag() {

super();

}

public void setTemplate(String templateName){

this.templateName = templateName;

}

public void setParameter(String parameter){

this.parameter = parameter;

}

public int doStartTag() {

try{

if (templateName != null){

template = (Template)pageContext.getRequest().getAttribute("template");

}

} catch (NullPointerException e){

Debug.println("Error extracting template from session: " + e);

}

if (parameter != null && template != null) templateParam = (TemplateParameter)template.getParam(parameter);

if (templateParam != null) directInclude = templateParam.isDirect();

return SKIP_BODY;

}

public int doEndTag() throws JspTagException {

try{

pageContext.getOut().flush();

} catch (Exception e){

// do nothing

}

try {

if (directInclude && templateParam != null) {

pageContext.getOut().println(templateParam.getValue());

} else if (templateParam != null) {

if (templateParam.getValue() != null) pageContext.getRequest().getRequestDispatcher(templateParam.getValue()).include(pageContext.getRequest(), pageContext.getResponse());

}

} catch (Throwable ex) {

ex.printStackTrace();

}

return EVAL_PAGE;

}

}

可以看到。InsertTag.java繼承了javax.servlet.jsp.tagext.TagSupport類. 因為在TagSupport中定義了一些接口.




主站蜘蛛池模板: 亚洲第一福利视频 | 五月天天色 | 青草国产在线观看 | 日韩视频免费看 | 亚洲成人毛片 | 人人揉揉香蕉 | 亚洲综合九九 | 日韩国产欧美精品综合二区 | 青草全福视在线 | 诱人的无内裤女教师bd | 中文字幕第30页 | 日本成人一区二区三区 | 一二三四高清在线手机视频 | 色姣姣狠狠撩综合网 | 天天干妹子 | 日韩a在线观看免费观看 | 性欧美人 | 日本一道本中文字幕 | 亚洲成人一级片 | 人人看人人做 | 午夜精品福利在线观看 | 欧美在线高清brazzers在线 | 日韩中文字幕在线有码视频网 | 亚洲产国偷v产偷v自拍涩爱 | 亚洲丁香网 | 亚洲欧美日韩一区成人 | 欧美性大战久久久久久久 | 色福利网 | 日韩中文字幕在线观看 | 日本黄色福利视频 | 日产国语一区二区三区在线看 | 天天色综合天天 | 伊人久久中文大香线蕉综合 | 日韩色中色| 日本五级床片全部免费午夜 | 最新四虎4hu影库地址在线 | 亚洲乱码国产一区网址 | 日韩在线一区视频 | 在线国产日韩 | 日本v片免费一区二区三区 日本vs欧美一区二区三区 | 桃花综合久久久久久久久久网 |