【发布时间】:2013-06-11 02:53:43
【问题描述】:
我在网上的 Spring MVC 示例中随处可见,我们可以在控制器的方法参数中使用 HttpServlet 请求和响应对象。但是当我使用它时。在下面的代码中给出。
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class StudentController {
public void testSyntax(HttpServletRequest request, HttpServletResponse response)
{
System.out.println("Inside testSyntax");
}
}
编译器抛出错误。 HttpServletRequest 请求无法解析为类型。 我正在使用 Spring MVC 3.0。谁能告诉我原因。
【问题讨论】:
-
在控制台异常是 java.lang.ClassNotFoundException: HttpServletRequest
标签: spring-mvc spring-3