jsp The method getServletContext() is undefined for the type in eclipse解决方法

来源:互联网 发布:对象数组的指针 编辑:程序博客网 时间:2024/05/01 06:49

jsp The method getServletContext() is undefined for the type in eclipse解决方法

2014-07-14 07:40:55CSDN-BEIDOUJS-点击数:1003
<iframe id="cproIframe_u848856_2" width="336" height="280" src="http://pos.baidu.com/acom?adn=3&amp;at=231&amp;aurl=&amp;cad=1&amp;ccd=24&amp;cec=UTF-8&amp;cfv=17&amp;ch=0&amp;col=zh-CN&amp;conBW=0&amp;conOP=1&amp;cpa=1&amp;dai=2&amp;dis=0&amp;ltr=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DabZTJR3vC2JFVHbv5D9RSVhyew82TolCDLZpsLOtfj5JoUJ_FQya7rvqi3CSm2CrCcuHm07E-ay_15ZbCPOIdK%26wd%3D%26eqid%3Da58f8fee0001269100000005559a5141&amp;ltu=http%3A%2F%2Fwww.th7.cn%2FProgram%2Fjava%2F201407%2F235865.shtml&amp;lu_161=10&amp;lunum=6&amp;n=smileking_cpr&amp;pcs=977x610&amp;pis=10000x10000&amp;ps=380x48&amp;psr=1440x900&amp;pss=977x381&amp;qn=057f208ff1767a56&amp;rad=&amp;rsi0=336&amp;rsi1=280&amp;rsi5=4&amp;rss0=%23FFFFFF&amp;rss1=%23FFFFFF&amp;rss2=%230000ff&amp;rss3=%23444444&amp;rss4=%23444444&amp;rss5=&amp;rss6=%23e10900&amp;rss7=&amp;scale=&amp;skin=tabcloud_skin_3&amp;stid=5&amp;td_id=848856&amp;titFF=%E5%AE%8B%E4%BD%93&amp;titFS=12&amp;titTA=left&amp;tn=text_default_336_280&amp;tpr=1436176728767&amp;ts=1&amp;version=2.0&amp;xuanting=0&amp;dtm=BAIDU_DUP2_SETJSONADSLOT&amp;dc=2&amp;di=u848856&amp;ti=jsp%20The%20method%20getServletContext()%20is%20undefined%20for%20the%20type&amp;tt=1436176728752.3225.3575.3576" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true"></iframe>

getServletContext()这个方法在Servlet 3.0规范里才有,要tomcat7才行。

如果使用的tomact6.0就会报这个错,必须增加一个extended Servlet,方法如下:

File->Properties -> Java Build Path -> Libraries -> Add Library -> Server Runtime


0 0
原创粉丝点击