• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

About final mock exam of Head First, question 21

 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Final exam of Head First book, question 21:

You have created a valid directory structure and a valid WAR file for your Java EE web application. Given that:
-ValidApp.war is the name of of the WAR file
-WARdir represents the directory that must exist in every WAR file.
-APPdir represents the directory that must exist in every web application.
Which is true?
A. The actual name of WARdir is NOT predictable.
B. The name of your application is NOT predictable.
C. In this directory structure, APPdir will exist inside WARdir.
D. In this directory structure, the application's deployment descriptor will reside in the same directory as WARdir.
E. Placing your application in a WAR file providers the option for the container to perform additional runtime checks not otherwise guranteed.


Regarding to option A, the explanation says
Option A: the directory must be called META-INF

I think the WARdir can either be META-INF or WEB-INF.
If WARdir is WEB-INF, then option D is correct.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2531
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is a trick question about the difference between what is mandatory in a WAR-file and what is mandatory in a web-application.

When you check the Servlet 3.0 specs about the structure of the WAR-file you can see that the WARdir in this question must be the META-INF directory:

10.6 Web Application Archive File
Web applications can be packaged and signed into a Web ARchive format (WAR) file using the standard Java archive tools. For example, an application for issue tracking might be distributed in an archive file called issuetrack.war. When packaged into such a form, a META-INF directory will be present which contains information useful to Java archive tools.
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, Frits. Thanks for the note.
But in a war file, there must be a WEB-INF and META-INF directories.
And the WEB-INF directory actually contains the most important files like those servlet Java classes, tag files, web.xml and etc.

Here is a notes :
http://www.examulator.com/moodle/mod/resource/view.php?id=455
It also highlights that WEB-INF is mandatory in web application while META-INF is mandatory in war file.

But when we unpack the war file, WEB-INF must be there.
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2531
112
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
True, I am not saying that the WEB-INF directory is not mandatory.

I am just saying that the WARdir of the problem statement has to be the META-INF and not the WEB-INF (that should be the APPdir).
 
Himai Minh
Ranch Hand
Posts: 1360
7
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I understand the question now.
We can create a war file without any servlet classes and etc. We can pack some JSP files in a .war file and this .war file must have META-INF.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic