用Eclipse开放web项目的时候 为什么找不见 httpSession...http...相关的都找不见?
/**
 * 取得HttpSession的简化函数.
 */
public static HttpSession getSession() {
return ServletActionContext.getRequest().getSession();
} /**
 * 取得HttpSession的简化函数.
 */
public static HttpSession getSession(boolean isNew) {
return ServletActionContext.getRequest().getSession(isNew);
} /**
 * 取得HttpSession中Attribute的简化函数.
 */
public static Object getSessionAttribute(String name) {
HttpSession session = getSession(false);
return (session != null ? session.getAttribute(name) : null);
}
        或者谁告诉我那个javax.servlet jar包在那找?

解决方案 »

  1.   

    javax.servlet 是 JavaEE的 servlet-api.jar一般是web容器提供如果楼主用myeclipse等ide开发 建web项目 不需要导此包如果楼主是自行编辑servlet,倒是需要到此包才能编译(不过有这样做的必要吗?)
      

  2.   

    Ctrl + Shift + o 试试 导入包
      

  3.   

    使用到Servlet需要导入一个servlet-api.jar的包,可以在Tomcat目录内找到:C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar 可参考更多Servlet文章
      

  4.   

    you need to put servlet jar in your classpath. 
    If you really learn java very well, you need to read java book written in English.
    learn more at http://www.java101.net/thread/viewthread.xhtml?id=238
      

  5.   


    MYEclipse是不用,可是如果要用Eclipse开发的话 该怎么执行?
      

  6.   

    少jar包 -- servlet-api.jar
      

  7.   

    可能是你的webServer没有配置好吧。
      

  8.   

    myeclipse web工程默认导入javaee.jar eclipse没有