Solved

Ant

Posted on 2007-03-31
3
1,016 Views
Last Modified: 2013-12-29
This is part of build.xml written by someone else.

I am not able to see my servlet in web.xml

From the Ant script i see they are using jasper2 to automatically generate Web.xml

How do i add a servlet that i coded to web.xml


<jasper2
             validateXml="false"
             uriroot="${build.dir}/xmlapps"
             webXmlFragment="${build.dir}/webroot-generated_web.xml"
             outputDir="${build.dir}/xmlapps/WEB-INF/src" />

        <echo message="Compiling JSP Source"/>
 
    <javac destdir="${build.dir}/xmlapps/WEB-INF/classes"
           optimize="off"
           debug="on" failonerror="false"
           srcdir="${build.dir}/xmlapps/WEB-INF/src">  
           <classpath refid="class.path" />  
           <include name="**/*.java" />
    </javac>


     <loadfile property="webxmlappsinc.xml" srcFile="${build.dir}/webroot-generated_web.xml"/>

     <copy file="${build.dir}/xmlapps/WEB-INF/web-template.xml" toFile="${build.dir}/xmlapps/WEB-INF/web.xml"
        filtering="true" overwrite="true">
        <filterset begintoken="&lt;" endtoken="&gt;">
            <filter token="!-- JSP Servlet Insertion Point --" value="${webxmlappsinc.xml}"/>
        </filterset>
      </copy>

        <!-- Create XML Admin WAR File -->
        <jar jarfile="${build.dir}/xmlapps.war">
            <fileset dir="${build.dir}/xmlapps">
                <include name="**/**"/>
            </fileset>          
        </jar>        
  </target>

    <target name="clean">
      <delete dir="${build.dir}" />
    </target>
</project>
0
Comment
Question by:cutie_smily
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 18831247
You might need to add it manually yourself. Or wait till somebody who knows Ant more than me posts.
0
 

Author Comment

by:cutie_smily
ID: 18832575
Above Ant code placing web.xml in a .ear file. And i place this .ear file in Jboss.
I tried to open .ear and save servlet in discriptor file but i am not able to save it.

none of them replying or helping out ..I am paying for this site every month to get some knowledge or help. It Was very useful but couple months i am not getting enough answers.Or i might be missing something. Anyway i will wait for the answers.

Thanks
0
 
LVL 8

Accepted Solution

by:
n_sachin1 earned 500 total points
ID: 18856011
The above ant structure pre-compiles the jsps in the web application and adds the generated java servlet references (from the jsps) into the web.xml. The web.xml that you see in the WEB-INF is a generated one

To add your servlet into the generated web.xml, you should add it to the template, that the generator is using.

In simpler words, add your servlet reference to ${build.dir}/xmlapps/WEB-INF/web-template.xml before the line:
<!-- JSP Servlet Insertion Point -->

Compare the ${build.dir}/xmlapps/WEB-INF/web-template.xml and the ${build.dir}/xmlapps/WEB-INF/web.xml and you'd understand what the ant script is doing.
Cheers
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question