jsp The method getServletContext() is undefined for the type in eclipse解决方法
2014-07-14 07:40:55
CSDN-
BEIDOUJS-
点击数:1003
id="cproIframe_u848856_2" width="336" height="280" src="http://pos.baidu.com/acom?adn=3&at=231&aurl=&cad=1&ccd=24&cec=UTF-8&cfv=17&ch=0&col=zh-CN&conBW=0&conOP=1&cpa=1&dai=2&dis=0<r=https%3A%2F%2Fwww.baidu.com%2Flink%3Furl%3DabZTJR3vC2JFVHbv5D9RSVhyew82TolCDLZpsLOtfj5JoUJ_FQya7rvqi3CSm2CrCcuHm07E-ay_15ZbCPOIdK%26wd%3D%26eqid%3Da58f8fee0001269100000005559a5141<u=http%3A%2F%2Fwww.th7.cn%2FProgram%2Fjava%2F201407%2F235865.shtml&lu_161=10&lunum=6&n=smileking_cpr&pcs=977x610&pis=10000x10000&ps=380x48&psr=1440x900&pss=977x381&qn=057f208ff1767a56&rad=&rsi0=336&rsi1=280&rsi5=4&rss0=%23FFFFFF&rss1=%23FFFFFF&rss2=%230000ff&rss3=%23444444&rss4=%23444444&rss5=&rss6=%23e10900&rss7=&scale=&skin=tabcloud_skin_3&stid=5&td_id=848856&titFF=%E5%AE%8B%E4%BD%93&titFS=12&titTA=left&tn=text_default_336_280&tpr=1436176728767&ts=1&version=2.0&xuanting=0&dtm=BAIDU_DUP2_SETJSONADSLOT&dc=2&di=u848856&ti=jsp%20The%20method%20getServletContext()%20is%20undefined%20for%20the%20type&tt=1436176728752.3225.3575.3576" align="center,center" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" allowtransparency="true">
getServletContext()这个方法在Servlet 3.0规范里才有,要tomcat7才行。
如果使用的tomact6.0就会报这个错,必须增加一个extended Servlet,方法如下:
File->Properties -> Java Build Path -> Libraries -> Add Library -> Server Runtime