This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JSP and the fly likes How to put jsp files in a folder in a web project? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "How to put jsp files in a folder in a web project?" Watch "How to put jsp files in a folder in a web project?" New topic
Author

How to put jsp files in a folder in a web project?

Ted Trip
Greenhorn

Joined: Aug 09, 2011
Posts: 8
I have a simple web project using default settings from eclipse. my web.xml has the default settings as:


If I put welcome.jsp file in webcontent folder it works, however I want to put the files in webcontent/web-inf/jsp flder inside web-inf folder.

I have tried doing in this way:



and it works. But I want to make this jsp folder as the default folder for webpages so that all the files will be pulled from this folder without giving any path. Can you please let me know how it can be done?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

WEB-INF is a special folder and it and its contents cannot be accessed via a URL.

The reason you could put your welcome page under WEB-INF, is that the welcome page element applies to a resource path (directory/filename), and not a URL. Although URL and filename paths look confusingly alike, they very definitely are not the same thing, so different rules apply.

The only way to put JSP files under WEB-INF and get them served would be if some intermediary software could be persuaded to respond to a URL and access the JSP for you. For example, I put my JSF page templates under WEB-INF/layout and the Facelets processor reads and processes them.

BTW, we have a JSF forum and a JSP forum. This is the JSF forum, but your question is really more of a JSP question. You'll get better/more answers when you post to the right forum.


Customer surveys are for companies who didn't pay proper attention to begin with.
Ted Trip
Greenhorn

Joined: Aug 09, 2011
Posts: 8
Thanks for the answer.

Tim Holloway wrote:...BTW, we have a JSF forum and a JSP forum. This is the JSF forum, but your question is really more of a JSP question. You'll get better/more answers when you post to the right forum.


I am sorry about that, I read it too fast so posted in JSF instead of JSP. If a mod can help me in moving it to JSP forum then it will be great!

Thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: How to put jsp files in a folder in a web project?
 
Similar Threads
how to insert an image
deployment under tomcat
Having a hard time getting my servlet to be available
How to call to another JSP from one JSP using spring??
at org.apache.myfaces.tomahawk.application.jsp.JspTilesTwoViewHandlerImpl.getServletMapping