2011-02-07 4 views
0

私はAjaxTags、特にhtmlContentタグを使用しようとしています。 JSPは、以下のようになります。AjaxJspTagが定義されていません

<%@ 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は、文字列、(HTMLタグまたは類似の)何もないとしてのみ「HalloText」を含む別のJSP、によって生成されます。そして、このページはブラウザにロードすることができます。

私が最初に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> 

そして、放火犯の報告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) 

誰かが間違っているものを、私にヒントを与えることができます(何私は間違っている)?

答えて

1

これは、クラスAjaxJspTagの定義を含むjavascriptライブラリが含まれていないという事実を指します。

次のようにライブラリのJavaScriptが含まれなければならない:

<script type="text/javascript" src="js/prototype.js"></script> 
<script type="text/javascript" src="js/scriptaculous/scriptaculous.js"></script> 
<script type="text/javascript" src="js/overlibmws/overlibmws.js"></script> 
<script type="text/javascript" src="js/ajaxtags.js"></script> 

私も参考のために、このページをチェックすることをお勧めします:AjaxTags JavaScript-JSP Library - QuickStart

+0

感謝を(あなたがステップ2で特に興味を持っているがそこに記載しました)... 。クイックスタートは古いAjaxTagsバージョン(1.3)で行われ、1.5.5を使用しています。しかし、これは、私が欠けているものでした。私のスクリプトのセクションは次のようになります: cupakob

関連する問題