NutzCN Logo
问答 index直接绑定跳转,index.html中直接for循环list
发布于 2006天前 作者 herexu 1946 次浏览 复制 上一个帖子 下一个帖子
标签:
    @At("")
    @Ok("beetl:/platform/wf/model/index.html")
    @RequiresPermissions("wf.cfg.model")
    public void index(HttpServletRequest req) {
        req.setAttribute("list", wfCategoryService.query(Cnd.orderBy().asc("location")));
    }
  <option value="">全部分类</option>
                    <%for(o in list){%>
                    <option value="${o.id!}" <%if(categoryId==o.id){%>selected<%}%>>${o.name!}</option>
                    <%}%>
3 回复

还没编辑完,按了下ENTER,怪我手贱
+++++++++++++++分割线++++++++++++++++++++++++++
继续描述,如果wfCategoryService.query(Cnd.orderBy().asc("location"))这个查询语句出错,那么,直接就500了,没有办法抛出定义好的错误信息

@wendal 这样子吗

public void index(HttpServletRequest req) {
try{
      req.setAttribute("list", wfCategoryService.query(Cnd.orderBy().asc("location")));
     }catch(Excetpion){
      req.setAttribute("errormsg", "报错啦,老铁");
    }
}
添加回复
请先登陆
回到顶部