Guest User

Untitled

a guest
Feb 25th, 2016
248
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1.     protected void processRequest(HttpServletRequest req, HttpServletResponse rep)
  2.     throws ServletException, IOException {
  3. //          rep.setContentType("application/json;charset=UTF-8");
  4.             String cmd = req.getParameter("cmd");
  5.             String path = "maintinfoAngularJS/WEB-INF/index.html";
  6.                    
  7.             rep.setContentType("application/json;charset=UTF-8");      
  8.                        
  9.             BeanArticle a = new BeanArticle();                 
  10.             Gson gson = new Gson();
  11.             Type type = new TypeToken<List<Article>>() {}.getType();
  12.             String json = gson.toJson(a.findArticle(), type);    
  13.             rep.setContentType("application/json");
  14.             rep.getWriter().write(json);
Advertisement
Add Comment
Please, Sign In to add comment