java - Spring MVC - Configure StringHttpMessageConverter for an @RequestMapping method which return string that interpreted as the logical view name -
i'm trying make @requestmapping
method return string(which path jsp file)
@requestmapping(value="/home", method=requestmethod.get) public string home(){ logger.info("home"); return "blog/home"; }
it worked until when defined mvc:annotation-driven
(i need set being able use @controlleradvice
) in dispatcher-servlet.xml
file. that's dispatcher-servlet.xml file
<?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <import resource="controllers.xml" /> <!-- resolves views selected rendering @controllers .jsp resources in /web-inf/views directory --> <bean class="org.springframework.web.servlet.view.internalresourceviewresolver"> <property name="prefix" value="/web-inf/views/" /> <property name="suffix" value=".jsp" /> </bean> <mvc:annotation-driven> <mvc:message-converters register-defaults="true"> <bean class="org.springframework.http.converter.stringhttpmessageconverter"> <property name="supportedmediatypes" value="text/*;charset=utf-8" /> </bean> </mvc:message-converters> </mvc:annotation-driven> </beans>
the return of thehome()
method interpreted http body. i'm getting issue in log
written [redirect:/blog/home] "text/html" using [org.springframework.http.converter.stringhttpmessageconverter@61f77969]
i don't know i'm missing path "blog/home" not interpret view reference
Comments
Post a Comment