creating web.xml - need help

V

vidya

hi,

I am using JSPs, java beans and java files for my project. Tomcat is
the server. I put all the java beans and files (compiled ones)in
WEB-INF directory.

The directory structure is,
myproject
|
JSPs + WEB-INF folder
|
classes folder + web.xml
|
.class files

I think my strcuture is correct, byt im having confusion about what
should i write inside web.xml file.

I should tell the server that the classes are in this particular
folder. right? And i think i should tell it using web.xml. but what is
the syntax for it?? can anybody please help me?

Thanks in advance.
Vidya
 
N

Nic

vidya said:
The directory structure is,
myproject
|
JSPs + WEB-INF folder
|
classes folder + web.xml
|
.class files

I think my strcuture is correct, byt im having confusion about what
should i write inside web.xml file.

I should tell the server that the classes are in this particular
folder. right? And i think i should tell it using web.xml. but what is
the syntax for it?? can anybody please help me?

Hi,
web.xml is in WEB-INF folder.
Tomcat looks for classes in WEB-INF/classes
and library in WEB-INF/lib.

You don't have to tell him explicitly in web.xml
bye
nic
 
J

Juha Laiho

vidya said:
I am using JSPs, java beans and java files for my project. Tomcat is
the server. I put all the java beans and files (compiled ones)in
WEB-INF directory.

The directory structure is,
myproject
|
JSPs + WEB-INF folder
|
classes folder + web.xml
|
.class files

I think my strcuture is correct, byt im having confusion about what
should i write inside web.xml file.

If I read that correctly, then, yes, your structure is correct.
Minimally, your web.xml just needs to contain the <web-app>
element, without any subelements - if you don't have any servlet
classes that should be accessible through URLs by clients (and
you don't have any need for the other functionality provided
by web.xml).
I should tell the server that the classes are in this particular
folder. right? And i think i should tell it using web.xml. but what is
the syntax for it?? can anybody please help me?

Please read the servlet specification (check which is the correct
specification version for the version of Tomcat you're using). The
servlet specification contains (among other, important, issues) the
syntax for web.xml.

There is a standard directory structure that is required for servlet
applications - this is the WEB-INF directory, having contents:
- web.xml file (mandatory)
- classes subdirectory (optional)
- lib subdirectory (optional)

.... but I still leave the details of this to the servlet specification,
which I consider to be mandatory material for anyone writing servlet
applications. See http://java.sun.com/products/servlet/ .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top