使用Myeclipse新建web项目后,index.jsp文件中报错

报错信息如下:

Multiple annotations found at this line:
	- String cannot be resolved to a type
	- The method getContextPath() from the type HttpServletRequest refers to the missing type 
	 String

这是项目没有配置java library 导致的。

解决办法:

1. 选择项目----右键build path----configure build path

2. 在Java Build Path----Libraries tab中,点击Add Library按钮

3. 选择JRE System Library,点击Next

4. 由于安装完Myeclipse之后就已经配置过jdk,直接点击Finish按钮

5. 可以看到JRE library添加成功,应用并关闭窗口,会看到报错信息消失。

Logo

北京人形旗下天工造物具身智能开源社区,聚焦具身天工与慧思开物两大平台

更多推荐