• 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

About final mock exam of Head First, question 21

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Creator of Enthuware JWS+ V6
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3411
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Bartender
Posts: 2418
13
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic