DEVFYI - Developer Resource - FYI

Must I place all my class files in the WEB-INF folder and all JSP's outside?

JMS Interview Questions and Answers


(Continued from previous question...)

2. Must I place all my class files in the WEB-INF folder and all JSP's outside?

A1:
The class files should place into WEB-INF/classes folder and the JSP files should place within a separate folder.

A2:
Yes! Otherwise the web server/ application server cannot access the .jsp files and classes.
The java class files can be placed either in WEB-INF/lib or WEB-INF/classes. But it is recommended to put the class files in WEB-INF/classes. The server will load the files from the classpath so it just will not matter where the class is.

A3:
Yes, class files is private resources, so you must store class in WEB-INF/classes folder.
JSP and HTML files should be placed outside.

A4:
Class files inside web-inf cannot be access by browsers, while the JSP files are meant for accessible by browsers so, it may be strictly place outside the web-inf only.

A5:
Here is structure of web app.
web (this folder is Accessible from www)
Store all your JSP and HTML files here
WEB-INF (this folder is not Accessible )
classes (store your classes here, classes you are using in jsp
lib (store 3rd party jars)


A6:
1. Class files - Either they must be in WEB-INF\classes directory OR you can package them as JAR and put in WEB-INF\lib
2. JSP files - Depends how do you design your arch. If you have controller/delegator that can forward requests to JSPs, you can keep them under WEB-INF directory also. If not, you have to keep them outside WEB-INF.

A7:
The Java Message Service (JMS) API is a messaging standard that allows application components based on the Java 2 Platform, Enterprise Edition (J2EE) to create, send, receive, and read messages. It enables distributed communication that is loosely coupled, reliable, and asynchronous

(Continued on next question...)

Other Interview Questions