SpringMVC访问WEB-INF下的jsp的方法

当输入localhost:8080/项目名

浏览器弹出不知道神马错误

The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or the jar files deployed with this application

出现这个问题百度的下说是将jstl-impl.jar包放到lib目录下就可以解决了,

尝试后确实可以解决问题。

然而,当我把这个jar包从我项目中删除后再访问又出现不一样的报错

java.lang.NoClassDefFoundError: org/apache/taglibs/standard/tag/rt/core/SetTag

也是缺少jatl-impl.jar包但是你给我报不一样错误干嘛呢

Message:The server encountered an internal error that prevented it from fulfilling this request.

大概意思是:服务器遇到内部错误,阻止其执行此请求。

项目中web.xml配置。只需要看<welcome-file></welcome-file>

 

因为是SpringMVC项目,我就想输入网址请求时候由Controller返回页面到浏览器不是更好吗,这就不需要找jar包那么麻烦了

定义一个映射

这样当输入localhost:8080/项目名    ==》servletDispatcher将这个请求发送到这个方法,然后返回页面就可以了。

@RequestMapping(value = "")

public String welcomeHandler()

{

  return "WEB-INF/views/login.jsp"

}

posted @ 2017-11-02 13:47  海绵般汲取  阅读(3802)  评论(0编辑  收藏  举报