AjaxTags、特に htmlContent タグを使用しようとしています。jsp は次のようになります。
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://ajaxtags.sourceforge.net/tags/ajaxtags" prefix="ajax"%>
<h1>HtmlContent Tag Demo</h1>
<div style="font-size: 90%; width: 650px;">
<p>The <code>ajax:htmlContent</code> tag fills a content area (e.g., DIV tag) with an HTML
fragment from another resource. You may find this tag useful for including blocks of information in
a sidebar when the user clicks a link or form field. This tag is a more simplified approach to the <code>ajax:portlet</code>
and <code>ajax:tabPanel</code> tags.</p>
<p>Shown below are three different ways of executing the AJAX event: link, radio button, and
select field.</p>
</div>
<h3>HtmlContent in Action</h3>
<div id="modelDescription" style="background-color: EAE9AF; width: 300px; height: 100px;"></div>
<div id="htmlContentForm">
<p>Select by ANCHOR link.</p>
<ul>
<li><a href="javascript://nop/" class="contentLink">Ford</a></li>
<li><a href="javascript://nop/" class="contentLink">Honda</a></li>
<li><a href="javascript://nop/" class="contentLink">Mazda</a></li>
</ul>
<form id="htmlContentForm">
<p>Select by RADIO option.</p>
<input type="radio" id="makeford" name="make" value="ford" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makeford">Ford</label><br />
<input type="radio" id="makehonda" name="make" value="honda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makehonda">Honda</label><br />
<input type="radio" id="makemazda" name="make" value="mazda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makemazda">Mazda</label><br />
<br />
<p>Select by SELECT option.</p>
<select id="selmake" name="selmake">
<option value="">Select one</option>
<option value="ford">Ford</option>
<option value="honda">Honda</option>
<option value="mazda">Mazda</option>
</select></form>
</div>
<div id="progressMsg" class="indicator" style="padding-top: 5px; display: none;">Loading...</div>
<div id="errorMsg"
style="display: none; border: 1px solid #e00; background-color: #fee; padding: 2px; margin-top: 8px; width: 300px; font: normal 12px Arial; color: #900"></div>
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" sourceClass="contentLink" target="modelDescription"
parameters="make={ajaxParameter}" />
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" sourceClass="contentRadio" target="modelDescription"
parameters="make={ajaxParameter}" />
<ajax:htmlContent baseUrl="${contextPath}/htmlcontent.htm" source="selmake" target="modelDescription"
parameters="make={selmake}" eventType="change" />
htmlcontent.htm は別の jsp によって生成されます。この jsp には、文字列として "HalloText" のみが含まれ、他には何も含まれていません (html タグなどはありません)。そして、このページはブラウザにロードできます。
最初のjspをロードすると、出力として次のようになります:
<h1>HtmlContent Tag Demo</h1>
<div style="font-size: 90%; width: 650px;">
<p>The <code>ajax:htmlContent</code> tag fills a content area (e.g., DIV tag) with an HTML
fragment from another resource. You may find this tag useful for including blocks of information in
a sidebar when the user clicks a link or form field. This tag is a more simplified approach to the <code>ajax:portlet</code>
and <code>ajax:tabPanel</code> tags.</p>
<p>Shown below are three different ways of executing the AJAX event: link, radio button, and
select field.</p>
</div>
<h3>HtmlContent in Action</h3>
<div id="modelDescription" style="background-color: EAE9AF; width: 300px; height: 100px;"></div>
<div id="htmlContentForm">
<p>Select by ANCHOR link.</p>
<ul>
<li><a href="javascript://nop/" class="contentLink">Ford</a></li>
<li><a href="javascript://nop/" class="contentLink">Honda</a></li>
<li><a href="javascript://nop/" class="contentLink">Mazda</a></li>
</ul>
<form id="htmlContentForm">
<p>Select by RADIO option.</p>
<input type="radio" id="makeford" name="make" value="ford" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makeford">Ford</label><br />
<input type="radio" id="makehonda" name="make" value="honda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makehonda">Honda</label><br />
<input type="radio" id="makemazda" name="make" value="mazda" class="contentRadio" /> <label
style="display: inline; cursor: pointer;" for="makemazda">Mazda</label><br />
<br />
<p>Select by SELECT option.</p>
<select id="selmake" name="selmake">
<option value="">Select one</option>
<option value="ford">Ford</option>
<option value="honda">Honda</option>
<option value="mazda">Mazda</option>
</select></form>
</div>
<div id="progressMsg" class="indicator" style="padding-top: 5px; display: none;">Loading...</div>
<div id="errorMsg"
style="display: none; border: 1px solid #e00; background-color: #fee; padding: 2px; margin-top: 8px; width: 300px; font: normal 12px Arial; color: #900"></div>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", parameters: "make={ajaxParameter}", sourceClass: "contentLink", target: "modelDescription"});</script>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", parameters: "make={ajaxParameter}", sourceClass: "contentRadio", target: "modelDescription"});</script>
<script type="text/javascript">new AjaxJspTag.HtmlContent({baseUrl: "/spring-mvc-hsqldb/htmlcontent.htm", eventType: "change", parameters: "make={selmake}", source: "selmake", target: "modelDescription"});</script>
そしてfirebugは3つのエラーを報告します:
AjaxJspTag is not defined <script type="text/javascript">new Aja...arget: "modelDescription"});</script> hello.htm (Zeile 46)
AjaxJspTag is not defined <script type="text/javascript">new Aja...arget: "modelDescription"});</script> hello.htm (Zeile 48)
AjaxJspTag is not defined <script type="text/javascript">new Aja...target: "modelDescription"});</script> hello.htm (Zeile 50)
誰かが私にヒントを与えることができますか、何が間違っていますか (私が間違っていること)?