将返回值表单控制器获取到ajax

时间:2018-07-28 20:27:35

标签: ajax spring-mvc

这是我的控制器,我正在其中通过列表传递返回值。在列表中有一些getId,getName,getDepartment值。我想将所有getName值传递给ajax

.urlopen()

这是我的ajax函数,我想从该函数中检索Kepress上的所有getName值。在Fiddler中,我正在获取值,但无法传递值

        @RequestMapping("employee/json")
        @ResponseBody
        public List<EmployeeBean> getDetails(String s1 ){


        Configuration configuration = new Configuration().configure("employee.cfg.xml").addAnnotatedClass(EmployeeBean.class);
        ServiceRegistry serviceRegistry = new ServiceRegistryBuilder().applySettings(configuration.getProperties()).buildServiceRegistry();

        SessionFactory sessionFactory = configuration.buildSessionFactory(serviceRegistry);

        Session session = sessionFactory.openSession();

        Transaction transaction = session.beginTransaction();

        org.hibernate.Query query = session.createQuery("from EmployeeBean");


        List<EmployeeBean> list = query.list();



        transaction.commit();
        session.close();


        return list;

    }

0 个答案:

没有答案