私は Apache Sling WCMS を開発しており、Java タグ ライブラリを使用して一部のデータをレンダリングしています。
IntelliJ IDEA 10.0 を使用しています
次の記述子とハンドラ クラスを使用して、jsp タグ lib を定義しました。
TLD ファイルには以下が含まれます。
<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.1" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd">
<tlib-version>1.0</tlib-version>
<short-name>taglibdescriptor</short-name>
<uri>http://bob/taglibs</uri>
<tag>
<name>testTag</name>
<body-content>tagdependent</body-content>
<tag-class>org.bob.taglibs.test.TestTagHandler</tag-class>
</tag>
</taglib>
タグ ハンドラ クラス:
package org.bob.taglibs.test;
import javax.servlet.jsp.tagext.TagSupport;
public class TestTagHandler extends TagSupport{
@Override
public int doStartTag(){
try {
pageContext.getOut().print("<h1>Helloooooooo</h1>");
} catch(Exception e) {
return SKIP_BODY;
}
return EVAL_BODY_INCLUDE;
}
}
タグ lib をBobTagLib.jarとしてパッケージ化し、 Sling Web コンソールを使用してバンドルとしてデプロイしました。
Sling リポジトリにデプロイされた jsp ページで、このタグ lib を使用しました。
index.jsp:
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="bob" uri="http://bob/taglibs" %>
<html>
<head><title>Simple jsp page</title></head>
<body>
<bob:testTag/>
</body>
</html>
(編集) MANIFEST.MF
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.3
Created-By: Bob Tech
Built-By: babak
Bundle-Version: 1.0.0
Bundle-Name: Bob Tag Library
Build-Jdk: jdk1.6.0_18
Bundle-Vendor: The Bob Technology Foundation
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.bob.taglibs
Bundle-Category: sling
ページを呼び出すと、次の例外が発生します。
org.apache.sling.scripting.jsp.jasper.JasperException: /apps/TagTest/index.jsp(7,5) Unable to load tag handler class "org.bob.taglibs.test.TestTagHandler" for tag "bob:testTag"
...
誰でも私に解決策を得ることができますか?
事前に、どんな助けでも大歓迎です。