首页 新闻 会员 周边 捐助

.net中VM模板引擎使用报错 Encountered "<EOF>" 求解,在线等

0
悬赏园豆:15 [已解决问题] 解决于 2011-10-20 16:41

异常详细信息: NVelocity.Runtime.Parser.ParseException: Encountered
"<EOF>" at line 21, column 2.
Was expecting one of:
   "("
...
   <RPAREN> ...
   <ESCAPE_DIRECTIVE>
...
   <SET_DIRECTIVE> ...
   "\\\\" ...
   "\\"
...
   <TEXT> ...
   <SINGLE_LINE_COMMENT> ...
   "*#"
...
   "*#" ...
   <STRING_LITERAL> ...
   <END>
...
   "if" ...
   "stop" ...
   <NUMBER_LITERAL>
...
   <WORD> ...
   <IDENTIFIER> ...
   <DOT>
...
   "{" ...
   "}" ...
堆栈跟踪:

[ParseException: Encountered "<EOF>" at line 21, column 2.
Was expecting one of:
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    <SINGLE_LINE_COMMENT> ...
    "*#" ...
    "*#" ...
    <STRING_LITERAL> ...
    <END> ...
    "if" ...
    "stop" ...
    <NUMBER_LITERAL> ...
    <WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    ]
   NVelocity.Runtime.Parser.Parser.Parse(TextReader reader, String templateName) +257
   NVelocity.Runtime.RuntimeInstance.Parse(TextReader reader, String templateName, Boolean dumpNamespace) +321
   NVelocity.Runtime.RuntimeInstance.Parse(TextReader reader, String templateName) +71
   NVelocity.Template.Process() +249

[ParseErrorException: Encountered "<EOF>" at line 21, column 2.
Was expecting one of:
    "(" ...
    <RPAREN> ...
    <ESCAPE_DIRECTIVE> ...
    <SET_DIRECTIVE> ...
    "\\\\" ...
    "\\" ...
    <TEXT> ...
    <SINGLE_LINE_COMMENT> ...
    "*#" ...
    "*#" ...
    <STRING_LITERAL> ...
    <END> ...
    "if" ...
    "stop" ...
    <NUMBER_LITERAL> ...
    <WORD> ...
    <IDENTIFIER> ...
    <DOT> ...
    "{" ...
    "}" ...
    ]
   NVelocity.Template.Process() +573
   NVelocity.Runtime.Resource.ResourceManagerImpl.LoadResource(String resourceName, ResourceType resourceType, String encoding) +273
   NVelocity.Runtime.Resource.ResourceManagerImpl.GetResource(String resourceName, ResourceType resourceType, String encoding) +414
   NVelocity.Runtime.RuntimeInstance.GetTemplate(String name, String encoding) +81
   NVelocity.Runtime.RuntimeInstance.GetTemplate(String name) +104
   NVelocity.App.VelocityEngine.GetTemplate(String name) +71
   HZ.PortalSystem.WebFile.StaticPage.SpecialSectionVM.Center1.TemplateProduct(List`1 infolist) in F:\Emed Project\源代码\门户网站\HZ.PortalSystem.WebFile\StaticPage\SpecialSectionVM\Center1.cs:74
   HZ.PortalSystem.WebFile.AdminManage.InformationManage.SpecializedTopicsList.OperateCheckStatus(Int32 status) in F:\Emed Project\源代码\门户网站\HZ.PortalSystem.WebFile\AdminManage\InformationManage\Special\SpecializedTopicsList.aspx.cs:189
   HZ.PortalSystem.WebFile.AdminManage.InformationManage.SpecializedTopicsList.btnCheckOK_Click(Object sender, EventArgs e) in F:\Emed Project\源代码\门户网站\HZ.PortalSystem.WebFile\AdminManage\InformationManage\Special\SpecializedTopicsList.aspx.cs:149
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565

问题补充:
//VM文件代码
<div class="content-middle-1-title">
<span class="news1">主要新闻栏目一</span>
<a href="#" class="more">[更多]</a>
</div>
<div class="topic">
<h1>
<a href="#">$top1.SHORTTITLE</a>
</h1>
<p class="paragraph">
$top1.SUMMARY[
<a href="#" target="_blank">详情</a>]
</p>
<h1>
<a href="#">$top2.SHORTTITLE</a>
</h1>
<p class="paragraph">
$top2.SUMMARY[
<a href="#" target="_blank">详情</a>]
</p>
#
foreach($row in $list)
<p>
<a href="#">
·[$row.INFOTYPE]$row.SHORTTITLE
</a>
</p>
</div>
桥段的主页 桥段 | 初学一级 | 园豆:162
提问于:2011-06-20 09:19
< >
分享
最佳答案
0

肯定是哪里语法错误了 把你的VM文件贴出来看看吧

收获园豆:15
码尔代夫iimax | 老鸟四级 |园豆:3138 | 2011-06-20 09:52
你好,VM文件在上面了,麻烦你有时间看看,谢谢你了
桥段 | 园豆:162 (初学一级) | 2011-06-20 10:06
${top1.SUMMARY} 应该用大括号括起来,不然会误以为你在调用索引
详情语法可以看我的博客http://www.cnblogs.com/iImax/archive/2010/04/22/1718121.html 也可以参考网上其他中文介绍
码尔代夫iimax | 园豆:3138 (老鸟四级) | 2011-06-20 12:22
其他回答(1)
0

在吗 你这个问题解决了没?

rumer | 园豆:64 (初学一级) | 2012-05-18 16:52
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册