Liron C
Liron C

Reputation: 181

Export web project to war file

Sorry if the question is basic, because I still new in this area.

I wrote JSP page, that call method in servlet.

At first I run it on eclipse using Tomcat Server. After it worked, I export the project into war file using Eclipse. This generate single file "project.war", and I place it in folder "webapps" under apache main folder. After I started the server and call the app from the browser I notice that additional folder was created in the webapps folder with the name of the project, and inside all the related java/jars files that the JSP uses.

I'm trying to understand how this folder was created, as the export generated single war file? And more important if I want to host the app in web (e.g. google engine app) what should I upload? I read somewhere that only the war file, but not clear how it will get the other related files?

Thanks

Upvotes: 1

Views: 1865

Answers (1)

NSKBpro
NSKBpro

Reputation: 383

War is more important for developers and in your question, you will upload only War file.

A web application is defined as a hierarchy of directories and files in a standard layout. Such a hierarchy can be accessed in its "unpacked" form, where each directory and file exists in the filesystem separately, or in a "packed" form known as a Web ARchive, or WAR file. The former format is more useful during development, while the latter is used when you distribute your application to be installed.

Every War is followed with root folder of project witch that war represent. There will be unpacked War file with following files.So basically it is job of server or in your case local server Apache Tomcatto unpack your War archive and make it usable on web (localhost in your case).

The top-level directory of your web application hierarchy is also the document root of your application. Here, you will place the HTML files and JSP pages that comprise your application's user interface. When the system administrator deploys your application into a particular server, he or she assigns a context path to your application. Thus, if the system administrator assigns your application to the context path /catalog, then a request URI referring to /catalog/index.html will retrieve the index.html file from your document root.

Also i suggest you to read documentation about this topic.

Upvotes: 1

Related Questions