• 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

Simple JSP problem !!

 
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends ,

I have some simple enough problem which i would like to highlight you guys.

Well i have simple written a simple jsp by the name first.jsp and i am putting this page in webapps in folder JSP in tomcat.Now when i run it it says - resource not available..but if i create a directory in JSP by the name WEB-INF this example runs.So can anyone tell me is it compulsory to have WEB-INF folder in the tomcat ?? I dont think it is necessary to have WEB-INF in case of JSP.

Please comment on that..
Also let me the know some good tutorial link for JSP.
Thanks,
Saurabh
 
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A web application is deployed using the war file. See the structure of war file a WEB-INF folder is required in that.
 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ali,
I could not really get your reply.Well i have tried earlier also without WEB-INF and the application worked as well.So i dont think thyat it is necessary to have WEB-INF folder.
Also tell me which war file to look at .
Thanks for help,
Saurabh
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To have a webapp you need a WEB-INF folder containing a web.xml file.
I'm not certain whether such is required when using ONLY JSPs but I think it is.

Using a WAR file for deployment is definitely NOT required, it's just a handy mechanism for distribution.

What URI are you using to try to access the JSP?
 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeroen Wenting:
To have a webapp you need a WEB-INF folder containing a web.xml file.
I'm not certain whether such is required when using ONLY JSPs but I think it is.

Using a WAR file for deployment is definitely NOT required, it's just a handy mechanism for distribution.

What URI are you using to try to access the JSP?



Thanks jeroen.Well the URI i am using to access the JSP page is :
http://localhost:8080/JSP/first.jsp

Since my JSP folder is in webapps .
still i am not satisfied whether or not to have WEB-INF incase of JSP .. i know it is must in servlet deployment.
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just think like that you will need web.xml when you will try to map your servlet with any URL. Suppose you want to access you first.jsp as /my/page then in this case you will have to map your first.jsp page to /my/page.
 
Saurabh Agrawal
Ranch Hand
Posts: 244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ali,
Thanks for ur reply but what you said is the use of web.xml and that too in the scenario when i want to have a mapping for a particular URL but i dont want that .. ten still is it compulsory to have WEB-INF folder hierarchy... i think noone has really given me the answer i am looking for ..

Thanks anyways,
SAurabh
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Well i have tried earlier also without WEB-INF and the application worked as well.So i dont think thyat it is necessary to have WEB-INF folder



If it worked then its alright don't put make that WEB-INF folder. But if you think somewhat practically then i think you will need all those beans and servlets and other things in your web application. In that case WEB-INF is required.
So if its working without WEB-INF in your case then it means you can do that.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic