这是我ant的目录,还有里面是没有.java后缀的!
|-bookstore-|-WEB-INF-------| -----|---classes-------|-XX.class
            |-src--------          |---lib---|--mysqldriver.jar     
            |--build.xml           |--web.xml
            |--xx.jsp              |
            |---......
            |
            |
                   |

解决方案 »

  1.   

    我半天没有明白过来
     ant 到低怎么不正确了? 可不可以说明白点
      

  2.   

    <web-app>
    <display-name>xxx</display-name>
      <description>
         xxxxx
      </description>
    <resource-ref>
           <description>DB Connection</description>
           <res-ref-name>jdbc/BookDB</res-ref-name>
           <res-type>javax.sql.DataSource</res-type>
           <res-auth>Container</res-auth>
       </resource-ref></web-app>
    这样试试还有贴出你的bulde.xml里面war那块代码
      

  3.   

    问一下,我也把一些jsp文件和WEB-INF相齐,就是说没有放在ant 指定的web目录下,如果我不想改自己的目录结构,怎么能用ant 呢?build.xml中有如下,
     <target name="build" depends="compile" >    <!-- Copy all the webapp content (jsp's, html, tld's, xml, etc. -->
        <!-- Note that this also copies the META-INF directory -->
        <copy    todir="${build.home}">
          <fileset dir="${web.home}"/>
        </copy>楼主是怎么做的,也把**.jsp放到web目录下了吗,
    哪位指点一下
      

  4.   

    我把jsp文件都放到web目录下,就成功了,原来放到build目录下的还是原先的jsp文件,没有web目录,就是说这个web目录并不影响打包后程序的运行,
    还有我的.web.xml文件中有:
     <resource-env-ref>
    <description>Orders Account DataSource</description>
    <resource-env-ref-name>jdbc/test</resource-env-ref-name>
    <resource-env-ref-type>javax.sql.DataSource</resource-env-ref-type>
    </resource-env-ref>
      

  5.   

    先谢谢各位回答问题,同时为我想问题不周到向各位道歉:我的build.xml文件
    <project name="bookstore" default="about" basedir=".">    <target name="init">
            <tstamp/>
            <property name="build" value="build" />
            <property name="src" value="src" />
            <property environment="myenv" />
            <property name="servletpath"  value="${myenv.CATALINA_HOME}/common/lib/servlet-api.jar" />
            <property name="mysqlpath" value="WEB-INF/lib/mysqldriver.jar" /> <mkdir dir="${build}" />
    <mkdir dir="${build}\WEB-INF" />
    <mkdir dir="${build}\WEB-INF\classes" />      <copy todir="${build}" >
            <fileset dir="${basedir}"    >
               <include name="*.jsp" />
               <include name="*.bmp" />
               <include name="WEB-INF/**" />
               <exclude name="build.xml" />
            </fileset>
         </copy>

       </target>
      <target name="compile" depends="init">             <javac srcdir="${src}"
                 destdir="${build}/WEB-INF/classes"
                 classpath="${servletpath}:${mysqlpath}">
         </javac>
      </target>
     
       <target name="bookstorewar" depends="compile">            <war warfile="${build}/bookstore.war" webxml="${build}/WEB-INF/web.xml">
    <lib dir="${build}/WEB-INF/lib"/>
    <classes dir="${build}/WEB-INF/classes"/>
    <fileset dir="${build}"/>
        </war> 
        </target>  <target name="about" >
            <echo> 
    This build.xml file contains targets 
           for building bookstore web application
            </echo>
       </target></project>
      

  6.   

    to  jFresH_MaN(TM) <target name="bookstorewar" depends="compile">            <war warfile="${build}/bookstore.war" webxml="${build}/WEB-INF/web.xml">
    <lib dir="${build}/WEB-INF/lib"/>
    <classes dir="${build}/WEB-INF/classes"/>
    <fileset dir="${build}"/>
        </war> 
        </target>
      

  7.   

    还有
    <display-name>xxx</display-name>
      <description>
         xxxxx
      </description>
    这个是有什么作用的?
      

  8.   

    那<display-name>xxx</display-name>呢?
    没有用吗?