spring map to xml viewresolver
항상 json으로만 뱉다가 xml로 뱉어야 하는 상황이 발생해서 만든 spring view 클래스 결과가 map에 경우에만 해당됨 아래 설정하고… applicationServlet.xml 1 2 3 4 <beans:bean id="xmlView2" class="org.springframework.web.servlet.view.XmlViewResolver"> <beans:property name="order" value="1"/> <beans:property name="location" value="classpath:xml-views.xml"/> </beans:bean> xml-views.xml 내용. 1 2 3 4 5 6 7 8 9 10 <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean name="xmlView" class="com.xxxxx.view.AjaxResponseXMLView"> <property name="contentType"> <value>text/xml;charset=utf-8</value> </property> </bean> </beans> AjaxResponseXMLView.java 아래 클래스를 이용함 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 public class AjaxResponseXMLView extends AbstractView { @Override protected void renderMergedOutputModel(Map map, HttpServletRequest request, HttpServletResponse response) throws Exception { String xmlHeader = "\r\n"; StringBuffer xmlSb = new StringBuffer(); xmlSb....