実行画面

tagBody.png

tagBodyExam.jsp

<%@ page contentType="text/html;charset=Windows-31J" %>
<%@ taglib uri="/WEB-INF/tag.tld" prefix="myTag" %>

<html>

<head>
<title>Tag Body Example</title>
</head>

<body>

BEFORE TAG

<hr/>

<myTag:bodyExam>
  あいうえお
</myTag:bodyExam>

<hr/>

AFTER TAG

</body>

</html>

tagBodyExam.java

package com.snail.sjcwc;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

public class TagBodyExam extends BodyTagSupport {
	public int doStartTag() throws JspException{
		return EVAL_BODY_BUFFERED;
	}

	public int doAfterBody() throws JspException {

		try {
			pageContext.getOut().print(
					"[[The tag body is \"" + bodyContent.getString() + "\".]]");
			pageContext.getOut().flush();
		} catch (IOException e) {
			e = null;
		}
		return SKIP_BODY;
	}
	public int doEndTag() throws JspException {

		try {
			pageContext.getOut().print(
					"タグボディは「" + bodyContent.getString() + "」でした");
		} catch (IOException e) {
			e = null;
		}
		return EVAL_PAGE;
	}
}

Java SJC-WC JSP#tagBody


添付ファイル: filetagBody.png 1716件 [詳細]

トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2006-11-20 (月) 01:54:17 (6374d)
Short-URL:
ISBN10
ISBN13
9784061426061