日期:2014-05-16  浏览次数:20310 次

关于:Extjs中,请求调用velocity *.vm文件 问题?
我的邮箱:dengyigang@126.com

在treeTest.htm 文件中,

MainPanel = function() {
this.urls=[];
this.homePage="pages/testvm.vm";//关键的调用,嵌入到extjs框架中。


this.currentUrl=this.homePage;
this.openTab = function(panel, id) {
var o = (typeof panel == "string" ? panel : id || panel.id);
var tab = this.getComponent(o);
if (tab) {
this.setActiveTab(tab);
} else if(typeof panel!="string"){
panel.id = o;
var p = this.add(panel);
this.setActiveTab(p);
}
};
。。。。。。。。



testvm.vm 定义如下:


<div id="center2">


<h1>书的详细描述</h1>
<a href="$link.setForward("searchEntry")">Search again</a>

<h3>$book.title</h3>

<b>ISBN:</b>$book.isbn<br>
<b>Title:</b>$book.title<br>
<b>Author:</b>$book.author<br>
<b>Price:</b>$book.price<br>
<b>No Pages:</b>$book.pages<br>
<b>Description:</b>$book.description<br>
<b>Publisher:</b>$book.publisher<br>
</div>



但是,部署后,没有数据返回。运行报以下错误:
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [info] ResourceManager : found /pages/testvm.vm with loader org.apache.velocity.tools.view.servlet.WebappLoader
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 17,column 21] : $book.title is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 19,column 29] : $book.isbn is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 20,column 30] : $book.title is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 21,column 31] : $book.author is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 22,column 30] : $book.price is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 23,column 33] : $book.pages is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 24,column 36] : $book.description is not a valid reference.
2008-6-16 11:01:06 org.apache.catalina.core.ApplicationContext log
信息: Velocity [warn] org.apache.velocity.runtime.exception.ReferenceException: reference : template = /pages/testvm.vm [line 25,column 34] : $book.publisher is not a valid reference.


不知道,为什么找不到路径,还请用的朋友,指点一下,谢谢:)