SpringMVC的相关配置:
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/" />
<property name="suffix" value=".jsp" />
<property name="contentType" value="text/html;charset=UTF-8"/>
</bean>
Controller:
@Controller
@RequestMapping("/search/")
public class SolrController {
@Autowired
private ItemSolrService service;
@RequestMapping("list.html")
public String itemList(ItemSolr item,Model model){
Map<String,String> params = new HashMap<String,String>();
if(item != null){
params.put("q", "title:" + item.getTitle());
}
List<ItemSolr> itemList = service.queryByMap(params, ItemSolr.class);
model.addAttribute("itemList", itemList);
return "item_cat_list";
}
}
我想要的是跳转到页面将数据显示在html页面上,但实际上把整个jsp页面作为字符串响应了,如下图:
有没有人知道原因?求帮助