Java/JSP QnA

9519 Çà¿ì¸®
2010-03-26 22:27:37
spring¿¡¼­ json»ç¿ëÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ¼­ ¾Ë°í½Í½À´Ï´Ù

ÇöÀç spring 2.5.6 ¾²°í Àִµ¥ jsonÀ» »ç¿ëÇØ¾ß Çϴµ¥ Á¤È®ÇÏ°Ô ¾î¶»°Ô »ç¿ëÇØ¾ß µÉÁö ¸ð¸£°Ú½À´Ï´Ù.. Ȥ½Ã ¿¹Á¦ ÀÖÀ¸¸é ¾Ë·ÁÁÖ½Ã¸é °¨»çÇϰڽÀ´Ï´Ù

  • json Áö¿øÇÏ´Â lib Ãß°¡ Çϼż­..
    view¸¦ jsonview·Î º¸³» Áֽøé
    jsonÀ» Âï¾î º¸½Ç ¼ö ÀÖ½À´Ï´Ù
  • 3171reperion
  • 2010-03-26 23:14:30
  • x
  • ±×³É json lib Ãß°¡Çؼ­
    ModelAndView modelAndView = new ModelAndView();

    BoardDTO boardDTO = new BoardDTO();
    boardDTO.setId("ddd");
    List list = new ArrayList();
    list.add(boardDTO);
    Map resultMap = new HashMap();
    resultMap.put("boardDTO", boardDTO);
    modelAndView.addAllObjects(resultMap);
    modelAndView.setViewName("jsonView");
    return modelAndView;
    josnView¶ó°í ÇÏ¸é µÇ³ª¿ä?
  • 9519kos720
  • 2010-03-27 00:17:06
  • x
  • public class JSONView extends AbstractView
    {

    public JSONView()
    {
    super();
    setContentType( "text/x-json; charset=euc-kr");
    }

    @SuppressWarnings("unchecked")
    @Override
    protected void renderMergedOutputModel( Map model, HttpServletRequest request,
    HttpServletResponse response) throws Exception
    {
    response.setContentType( getContentType());
    response.getWriter().write( JSONSerializer.toJSON( model.get( "JSON_OBJECT")).toString());
    }

    }

    jsonview Ŭ·¡½º¸¸µé°í
    return new ModelAndView( new JSONView(), favoriteService.getList( request, "public"));
    }

    public Map<String, JSONObject> getList( HttpServletRequest request, String type) {
    model.put( "JSON_OBJECT", jsonObj);

    return model;
    }

    ÀÌ·¸°Ô...;;
    ¸®ÅÏÇÒ °´Ã¼¸¦ jsonÀ¸·Î ¸¸µç ÈÄ¿¡
    json°´Ã¼¸¦ ´äÀº mapÀ» jsonview·Î ¸®ÅÏ @_@

  • 3171reperion
  • 2010-03-27 00:41:21
  • x
  • À½...±×³É ³Ñ±æµ¥ÀÌÅ͸¦ StringBuffer¸¦ ÀÌ¿ëÇØ¼­.
    jsonÇüÅÂÀÇ stringÀ¸·Î ¸¸µå½ÅÈÄ...³Ñ±â½ÅÈÄ
    ²¨³»¾²½Ã¸é µÇ½ÇÅÍÀδë..
  • 8655¾î¼´Ùº¸´ÏÇÁ·Î±×·¡¸Ó
  • 2010-03-27 11:20:14
  • x
  • °¨»çÇÕ´Ï´Ù ¿­½ÉÈ÷ ÇØº¼²²¿ä
  • 9519kos720
  • 2010-03-27 17:06:45
  • x
  • ±×³É Äݹé¹Þ´Â viewÆäÀÌÁö¿¡ ¾Æ¹« ű׾øÀÌ ±×³É json¾ç½ÄÀ¸·Î ±âÀçÇÏ½Ã¸é µË´Ï´Ù...º°°Å ¾øÀ½..
  • 6293¸¸µÎ¸Ç
  • 2010-03-27 22:44:20
  • x
´ÙÀ½±Û java.net.SoketException : Broken pipe ¿¡·¯ÀÔ´Ï´Ù
>> 54010 spring¿¡¼­ json»ç¿ëÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ¼­ ¾Ë°í½Í½À´Ï´Ù  [6] Çà¿ì¸® 6628 2010-03-26 22:27:37
ÀÌÀü±Û Struts2 Áú¹®Àε¥ ³Ê¹« ±âº»ÀûÀÎ °ÍÀε¥.. ã¾ÆºÁµµ ã±â°¡ Èûµå³×¿ä¤Ð¤Ð