日期:2014-05-20 浏览次数:20796 次
<servlet> <servlet-name>spring</servlet-name> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>spring</servlet-name> <url-pattern>*.do</url-pattern> </servlet-mapping>
@Controller public class RuleController { private Log log = LogFactory.getLog(RuleController.class); /** * * @param model * @param request * @param response * @return * */ @RequestMapping(value = "/login.do", method = RequestMethod.POST) public ModelAndView logon(HttpServletRequest request, HttpServletResponse response, User user) { ModelAndView model = new ModelAndView("hello"); model.addObject("pwd", user.getPassWord()); log.info("log in!"); return model; } }
<bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/pages/" /> <property name="suffix" value=".jsp" /> </bean>