}
CompiledScript compiledscript = CompileScriptEngine
.getCompileScript(config.getApplicationId(),
"tag", template.getTag());
Bindings bind = compiledscript.getEngine().getBindings(
ScriptContext.ENGINE_SCOPE);
bind.put("title_for_layout", config.getTitle());
bind.put("description_for_layout",
config.getDescription());
bind.put("keyword_for_layout", config.getKeyword());
bind.put("css_for_layout", template.getCss());
bind.put("js_for_layout", template.getJs());
CategoryModel cateModel = new CategoryModel();
cateModel.prepareAll();
TagModel tagModel = new TagModel();
tagModel.prepareList();
bind.put("current_tag", obj);
bind.put("recent_view",
RecentViewHelper.getRecentView());
bind.put("list_tag", tagModel.getListResult());
bind.put("list_category", cateModel.getListResult());
List<News> listResult = new ArrayList<News>();
listResult = obj.recoverListNews();
int start = (page - 1) * limit;
double dLimit = limit;
bind.put("total_page",
(int) Math.ceil(listResult.size() / dLimit));
try {
listResult = listResult
.subList(start, page * limit);
} catch (Exception e) {
try {
listResult = listResult.subList(start,
listResult.size());
} catch (Exception e2) {
}
}
bind.put("articles", listResult);
bind.put("current_page", page);
try {
resp.getWriter().print(
(String) compiledscript.eval());
} catch (Exception e) {