IDEA使用中,jsp的request可以智能提示,request的方法却没有
如图,idea可以自动补全request,但是,getContextPath方法却没有智能提示,而且代码标红,但是,结果却输出正常。
这应该是本地缺少jsp的依赖,在pom文件中添加jsp-api的依赖后,仍然标红,没有解决。
根据标红处的idea提示“Cannot resolve method ‘getContextPath()’”google到的解决办法:
Cannot Resolve Method(JSP)
Module dependencies
打开菜单栏file的project structure 选择左侧的modules,如图选择增加lib
添加tomcat的lib在本地,后面的scope位provided,表示,打包的时候不会打进去,所以本地编写代码时就可以有提示了。
转载于//juejin.im/post/5cccf6edf265da038e54b9da
还没有评论,来说两句吧...