最近開始接觸SpringMVC這個框架,這個框架使用起來很方便,框架搭起來之后,寫起代碼幾乎都是一個模式。當然要走到這一步必須保證你的SpringMVC的相關配置都已經(jīng)完成,并且配置正確!
作為我的關于S平ringMVC的首篇博客,本篇博客主要說名如何配置SpringMVC,并且可以使之正常的返回Bean實體,這里的bean實體一般返回到前端都是以Json字符串的形式返回的。
使用的開發(fā)工具為eclipse,這個也是比較大眾化的開發(fā)工具了,算的上是人人都會使用的了,只是熟練程度不一樣!
具體的配置如下:
web.xml:
<?xml version="1.0" encoding="UTF-8"?>contextConfigLocation classpath:applicationContext.xml org.springframework.web.context.ContextLoaderListener ReturnJsonDemo index.jsp dispatcher org.springframework.web.servlet.DispatcherServlet contextConfigLocation classpath:dispatcher-servlet.xml dispatcher /