2011-02-07 8 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에 의해 생산된다. 그리고이 페이지는 브라우저에로드 할 수 있습니다.

<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 오류 :

내가 처음 JSP를로드

, 그때 내가 출력으로 다음 얻을

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 클래스의 정의가 포함 된 자바 스크립트 라이브러리가 포함되어 있지 않다는 사실을 나타냅니다.

<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 (2 단계가 설명에 특히 관심이)

+0

덕분에 ... . 빠른 시작은 이전 Ajaxtags 버전 (1.3)에서 작성되었으며 1.5.5를 사용하고 있습니다. 그러나 이것은 내가 놓친 것입니다. 내 스크립트 섹션은 다음과 같습니다 : cupakob

관련 문제