【发布时间】:2011-12-26 10:58:04
【问题描述】:
我正在使用 Struts MVC 构建一个小 portlet,用于搜索/列出来自 web 服务的书籍。
在我的第一个测试中,我将 Velocity 工具集成到我的 Struts 项目中没有问题。
最后一步是允许用户选择是否要使用velocity。如果是,则速度脚本将来自 Web 服务作为字符串。 我将测试放在 JSP 页面中,以便可以应用以下算法:
List<Book> books = myWebservice.getAllBooks();
if (user.preference.vm = enabled ){
String velocityScript = myWebservice.getARandomVelocityScript()
renderTheBooks(velocityScript,books);
}
else{
use JSP and/or struts tags to generate the content
}
问题出在renderTheBooks(velocityScript,books) 行:我该如何编码?
谢谢你,问候。
(我知道架构可能看起来有点奇怪,但请让我们讨论renderTheBooks 方法。我会很感激你理解这一点。)
【问题讨论】:
标签: java struts velocity template-engine