• 检测商品简码是否唯一,不重复


    Action:

    /*

        * 检测商品简码是否唯一,不重复

        */

       public String checkCode() throws Exception {

          try {

            HttpServletRequest request = Struts2Utils.getRequest();

            String goodscode = request.getParameter("goodscode");

            String oldGc = request.getParameter("oldGc");

            goodscode = new String(goodscode.getBytes("iso8859-1"), "UTF-8");

            oldGc = new String(oldGc.getBytes("iso8859-1"), "gb2312");

    [d1]       if (busiGoodManager.isCodeUnique(goodscode, oldGc)) {

               Struts2Utils.renderText("true");

            } else {

               Struts2Utils.renderText("false");

            }

          } catch (Exception ex) {

            logger.error(ex.getMessage());

            Struts2Utils.renderText("false");

          }

          return NONE;

       }

    Service:

    public boolean isCodeUnique(String name, String oldName) {

          return busiGoodDao.isPropertyUnique[d2] ("goodscode", name, oldName);

       }

    Dao:

    /**

     *商品的泛型DAO类.

     *

     * @author ligy

     */

    @Component

    public class BusiGoodDao extends HibernateDao<BusiGood, Long> {

     

    }


     [d1]处理中午乱码

     [d2]Springside中,继承hibernatedao后直接调用

  • 相关阅读:
    Metrics.NET
    DotNet Multithread
    WebApi框架概述
    RESTful API 概述
    MvcPager分页控件以适用Bootstrap效果
    Windows集群网络负载均衡
    学习Oracle日记(10)-数据类型
    在Eclipse中使用Junit4进行单元测试
    Android--学习笔记--02--AndroidStudio的设置
    Android--学习笔记--01--开发软件安装
  • 原文地址:https://www.cnblogs.com/pujiajia/p/3287255.html
Copyright © 2020-2023  润新知