AjaxJspTag 未定义
我正在尝试使用 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 生成,其中仅包含“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>
And firebug report 3 Errors:
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)
有人能给我一个提示,出了什么问题(我做错了什么)?
I'm trying to use AjaxTags, especially the htmlContent tag. The jsp looks as follow:
<%@ 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" />
The htmlcontent.htm is produced by another jsp, which contains only "HalloText" as string, nothing else (no html tags or similar). And this page can be loaded in the browser.
When i load the first jsp, then i get following as output:
<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>
And firebug report 3 Errors:
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)
Can someone give me a hint, what is wrong (what i'm doing wrong)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是指没有包含 AjaxJspTag 类定义的 javascript 库。
应包含以下 javascript 库:
我还建议检查此页面以供参考: AjaxTags JavaScript-JSP Library
- 快速入门(您对其中描述的步骤 2. 特别感兴趣)
This refers to the fact that there is no javascript library included containing definition of the class AjaxJspTag.
The libraries javascripts should be included as follows:
I also recommend to check this page for reference: AjaxTags JavaScript-JSP Library
- QuickStart (You are especially interested in step 2. described there)