page = Integer.parseInt((String) req
.getParameter("page"));
} catch (Exception e) {
page = 1;
}
NewsModel model = new NewsModel();
model.setPage(page);
model.prepareList();
CategoryModel cateModel = new CategoryModel();
cateModel.prepareAll();
TagModel tagModel = new TagModel();
tagModel.prepareList();
CompiledScript compiledscript = CompileScriptEngine
.getCompileScript(config.getApplicationId(),
"home", template.getHome());
if (compiledscript != null) {
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());
bind.put("recent_view",
RecentViewHelper.getRecentView());
bind.put("list_tag", tagModel.getListResult());
bind.put("list_category", cateModel.getListResult());
bind.put("current_page", model.getPage());
bind.put("total_page", model.getTotalPage());
bind.put("articles", model.getListResult());
try {
resp.getWriter().print(
(String) compiledscript.eval());
} catch (Exception e) {
e.printStackTrace();