Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ant

Posted on 2007-03-31
3
Medium Priority
?
1,022 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 2000 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

Docker-Compose to Simplify Multi-Container Builds

Our veteran DevOps Author takes you through how to build a multi-container environment, managed with a single utility in order to simplify your deployments.

Question has a verified solution.

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

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…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

670 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