jsp页面中用到pageContext.request.contextPath报错问题

jsp页面部分代码

<frameset frameborder="no" rows="100px, * , 30px">
	<frame name="top" scrolling="no"
		src="${pageContext.request.contextPath}/ui_topUI.action">
	<frameset cols="180px, *" frameborder="no">
		<frame name="left" scrolling="no"
			src="${pageContext.request.contextPath}/ui_leftUI.action">
		<frame name="right" scrolling="no"
			src="${pageContext.request.contextPath}/ui_rightUI">
	</frameset>
	<frame name="bottom" scrolling="no"
		src="${pageContext.request.contextPath}/ui_bottomUI.action">
</frameset>

 此时eclipse报红色感叹号,错误为javax.servlet.jsp.jspException can not reslove a type

从网上查得知,缺少jsp-api.jar

 

我最初是把这个jar包加到了工程WEB/INF/lib目录下,运行又报了错

 空指针异常

 

继续往上搜索答案,终于找到原因了

不能直接把这个jar包加到了工程WEB/INF/lib目录下,而是需要引用tomcat/lib下面的jsp-lib.jar包

 

再次运行,成功

发布了36 篇原创文章 · 获赞 3 · 访问量 6479
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章