<!-- spring mvc 配置 -->
<servlet>
<servlet-name>dispacther</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:/dispacther-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispacther</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
<!-- 浏览器不支持put,delete等method,由该filter将/xxx?_method=delete转换为标准的http delete方法 -->
<filter>
<filter-name>HiddenHttpMethodFilter</filter-name>
<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
</filter>
@RequestMapping(value = "/guarantee/guarantee/productTypes", method = RequestMethod.GET)
public void queryProductTypeList(HttpServletRequest httpRequest,
HttpServletResponse httpResponse) throws Exception {
JSONArray array = new JSONArray();
User user = getLoginUser(httpRequest);
Map map = new HashMap();
map.put("user", user);
List<ProductType> productTypes = productService.getProductTypeByCondition(map);
if (productTypes != null&&productTypes.size()>0) {
for (ProductType p : productTypes) {
JSONObject jsonObject = GuaranteeActionUtil.productTypeToJson(p);
array.add(jsonObject);
}
}
productTypes = null;
user = null;
responseWrite(httpResponse, array);
}