• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

writing web.xml

 
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi all
actually my server guy has deleted web.xml by mistake & now i not able to run servlets.
can someone help me in writing a web.xml to even run a simple HelloWorld application.
i wrote web.xml as follows, plz specify any modifications to be done :
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<servlet>
<servlet-name>
HelloWorld
</servlet-name>
<servlet-class>
HelloWorld
</servlet-class>
</servlet>

</web-app>
tia
malhar
 
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are using tomcat4, you can also go to {tomcat_install_dir}\conf and copy the web.xml file there. Copy it to your webapps's WEB-INF folder and edit this web.xml to your preferences.
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

If you are using tomcat4, you can also go to {tomcat_install_dir}\conf and copy the web.xml file there. Copy it to your webapps's WEB-INF folder and edit this web.xml to your preferences.


dear
actually i dont hv access to any other folders, so cant copy frm there & basically the server is maintained by a fool...he doesnt know any thing abt configurations & all my requests wud be remain unattended. so basically i'll hv to rewrite the file...
thnx anyway
malhar
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well... okay.
Anyway your web.xml looks ok unless you happen to package your servlets.
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anyway your web.xml looks ok unless you happen to package your servlets.


well...
i m not using package but still its giving 404 error..
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you using a servlet mapping in your request URL? Something like
http://{hostname}:{port}/{context}/{url-mapping}
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Originally posted by Anthony Villanueva:

Are you using a servlet mapping in your request URL? Something like
http://{hostname}:{port}/{context}/{url-mapping}


no dear
i m just using
http://<hostname>/servlet/<servletclassfile>
ta...still
malhar
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
somebody plz help.. :roll:
malhar
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry... I was out.
You have to find out the HTTP port.
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you restart the server?
and did you put the web.xml in 'webapps/ROOT/WEB-INF/'?
Rene
[ July 30, 2002: Message edited by: Rene Larsen ]
 
Malhar Barai
Author
Posts: 399
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you restart the server?
and did you put the web.xml in

'webapps/ROOT/WEB-INF/'?
Rene


dear rene
i only hv access to web-inf folder, cant know if its under web-apps/ROOT...
i m still looking at anthony's solution & trying to get the port, but if the port is 80 i think we wud be better off writing as
http://<hostname>/... instead of
http://<hostname>:80/...
thnx anyway
malhar
 
Anthony Villanueva
Ranch Hand
Posts: 1055
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rene is right. You have to find out somehow if the web.xml is in the right directory. Also you must restart Tomcat for your new web.xml to take effect.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi have a look
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"web-app_2_3.dtd">
<web-app>
<display-name>urchoice</display-name>
<description>
any message description
</description>
<servlet>
<servlet-name>HelloServlet</servlet-name>
<description>
abt servlet
</description>
<servlet-class>myservlet.servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloServlet</servlet-name>
<url-pattern>/hello/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
regds
----------
if any problem chk the version of
web-app_2_3.dtd
and use according
----------------
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic