需要放到form表单中
<form action="${pageContext.request.contextPath }/Dormitory/findByRoomName.do">
搜索房间号:<input type="text" name="name" id="name"/>
<input type="submit" value="查询" >
</form>
@RequestMapping("/findByRoomName")
public ModelAndView findByRoomName(HttpServletRequest request)
{
String name=request.getParameter("name");
ModelAndView mv = new ModelAndView();
List<Dormitory> dors = service.findByRoomName(name);
mv.addObject("dormitory",dors);
mv.setViewName("dormitorylist");
return mv;
}