问答详情
源自:1-2 Servlet+Ajax实现原理图解

将json改成jsonAyyy在提示框内打印出来

如果servlet连接数据库,返回的是list类型的数组,jsp页面该怎样解析jsonArry并打印道下面提示框内

提问者:qq_矮油不绰_0 2018-04-17 21:38

个回答

  • qq_矮油不绰_0
    2018-04-17 21:45:17

    ()
    {
        (.=== )
            (.=== )
            {
                =.responseText;
                = .();
                ();
            }
    }


  • qq_矮油不绰_0
    2018-04-17 21:43:36

     doGet(HttpServletRequest request, HttpServletResponse response) ServletException, IOException
        {
            request.setCharacterEncoding( );
            response.setCharacterEncoding( );
    
            String keyword=request.getParameter( );
            ArticleService articleService=ArticleService();
            UserService userService = UserService();JSONArray jsonArray = JSONArray();
            List<Bbs_litleArt> listData1 = articleService.search_article( keyword );
            (Bbs_litleArt bbs_litleArt:listData1) {
              JSONObject jsonObject = JSONObject( bbs_litleArt );
                jsonArray.put( jsonObject );
            }
            System..println(jsonArray);
    
    response.getWriter().write(String.(jsonArray));
    
        }