我正在使用Jaxb2Marshaller作爲ContentNegotiatingViewResolver的視圖屬性。我能夠得到xml repsonse。我如何格式化(漂亮的打印)呢?如何在spring中從jaxb獲取格式化的xml輸出?
<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="mediaTypes">
<map>
<entry key="xml" value="application/xml" />
</map>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.xml.MarshallingView">
<constructor-arg>
<bean class="org.springframework.oxm.jaxb.Jaxb2Marshaller">
<property name="classesToBeBound">
<list>
</list>
</property>
</bean>
</constructor-arg>
</bean>
</list>
</property>
</bean>
謝謝,那就是訣竅。 – outvir 2011-02-04 02:21:23