同样的代码 在普通类里可以读到  在jsp里就根本连while循环都进不去,但是en又是有值的...我jsp里的代码如下<%         CommPortIdentifier portId;            Enumeration en = CommPortIdentifier.getPortIdentifiers();
      System.out.println(en);
            // iterate through the ports.
            while (en.hasMoreElements()) {
            System.out.print("xxxxxx");
                portId = (CommPortIdentifier) en.nextElement();
                if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
      %>             <option><% portId.getName();%></option>
<%  out.print(11+portId.getName());        }
            } %>

解决方案 »

  1.   

    en.hasMoreElements() 这个false吧
      

  2.   

        没有啊 编译是能通过 但是他连while都进不去 !
      

  3.   

    我知道是false啊 我就是想知道为什么会是false啊!我在java类里用好好的 没出什么错啊 为什么到jsp页面来就出错了!
      

  4.   

    可能是你JavaEE的容器的lib没有required的jar?
      

  5.   

    什么意思 jar包吗 我导入到项目里了啊 你说的是什么意思额
      

  6.   

    前台debug一下,后台能跑通的前台不一定可以,后台有值前台不一定有