動的コンテンツ (ネストされたタグ) に埋め込まれたカスタム タグがレンダリングされません。
javabean から動的コンテンツを取得し、オブジェクトのリストをカスタム タグに渡して html に処理するページがあります。各オブジェクト内には、レンダリングしたい 2 番目のカスタム タグを含む、出力される html の束があります。問題は、タグの呼び出しがプレーンテキストとしてレンダリングされることです。
例は私にとってより役立つかもしれません。
1 データベースから情報を取得し、javabean を介してページに返します。この情報を出力用のカスタム タグに送信します。
<jsp:useBean id="ImportantNoticeBean" scope="page" class="com.mysite.beans.ImportantNoticeProcessBean"/> <%-- Declare the bean --%>
<c:forEach var="noticeBean" items="${ImportantNoticeBean.importantNotices}"> <%-- Get the info --%>
<mysite:notice importantNotice="${noticeBean}"/> <%-- give it to the tag for processing --%>
</c:forEach>
このタグは、次のようなボックス div を出力する必要があります
*SNIP* class for custom tag def and method setup etc
out.println("<div class=\"importantNotice\">");
out.println(" " + importantNotice.getMessage());
out.println(" <div class=\"importantnoticedates\">Posted: " + importantNotice.getDateFrom() + " End: " + importantNotice.getDateTo()</div>");
out.println(" <div class=\"noticeAuthor\">- " + importantNotice.getAuthor() + "</div>");
out.println("</div>");
*SNIP*
これは問題なく、期待どおりにレンダリングされます
<div class="importantNotice">
<p>This is a very important message. Everyone should pay attenton to it.</p>
<div class="importantnoticedates">Posted: 2008-09-08 End: 2008-09-08</div>
<div class="noticeAuthor">- The author</div>
</div>
2 たとえば、上記の例で、importantNotice.getMessage() 文字列にカスタム タグがあるとします。
*SNIP* "This is a very important message. Everyone should pay attenton to it. <mysite:quote author="Some Guy">Quote this</mysite:quote>" *SNIP*
重要な通知は問題なくレンダリングされますが、引用タグは処理されず、単純に文字列に挿入され、プレーン テキスト/html タグとして配置されます。
<div class="importantNotice">
<p>This is a very important message. Everyone should pay attenton to it. <mysite:quote author="Some Guy">Quote this</mysite:quote></p>
<div class="importantnoticedates">Posted: 2008-09-08 End: 2008-09-08</div>
<div class="noticeAuthor">- The author</div>
</div>
それよりも
<div class="importantNotice">
<p>This is a very important message. Everyone should pay attenton to it. <div class="quote">Quote this <span class="authorofquote">Some Guy</span></div></p> // or wahtever I choose as the output
<div class="importantnoticedates">Posted: 2008-09-08 End: 2008-09-08</div>
<div class="noticeAuthor">- The author</div>
</div>
これがプロセッサとプリプロセッサに関係していることは知っていますが、これを機能させる方法についてはわかりません。