예제 #1
0
 // 初始化更新新闻页面,不使用ActionForm,主键通过URL由HttpServletRequest对象获取
 public ActionForward updateView(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   int num = Integer.parseInt(request.getParameter(Name.Property));
   String hql = "from News news where news.num='" + num + "'";
   News news = Controller.get(hql);
   request.getSession().setAttribute(Name.AdminNews, news);
   response.sendRedirect("news_update.jsp");
   return null;
 }
예제 #2
0
 // 处理事务:开启新闻或是关闭新闻,不使用ActionForm,主键通过URL由HttpServletRequest对象获取
 public ActionForward setIsUsed(
     ActionMapping mapping,
     ActionForm actionForm,
     HttpServletRequest request,
     HttpServletResponse response)
     throws Exception {
   int num = Integer.parseInt(request.getParameter(Name.Property));
   String hql = "from News news where news.num='" + num + "'";
   News news = Controller.get(hql);
   String code = request.getParameter("code");
   if ("start".equals(code)) {
     news.setIsUsed(true);
   } else {
     news.setIsUsed(false);
   }
   Controller.update(news);
   response.sendRedirect("news_view.do?method=viewList");
   return null;
 }
예제 #3
0
파일: Shop.java 프로젝트: NEILXIANG/skyland
 public static String getName(int num) {
   String hql = "select shop.name from Shop shop where shop.num='" + num + "'";
   Object obj = Controller.get(hql);
   return (String) obj;
 }