• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF view path

 
Edgar Castanedo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to change the view path for files?

So that when someone visits *.faces, the directory it searches for *.jsp files is user defined? Or is it always in the root web app directory? I like to put my files under WEB-INF/jsp or something similar....

Thanks In Advance!
 
Ali Gohar
Ranch Hand
Posts: 572
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not understood your question, please explain
 
Edgar Castanedo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, I have a page called test.jsp.

The URL to get to it is: http://localhost:8080/something/test.faces

This resolves to test.jsp, because of the way JSF works.

test.jsp has to be in the document root directory (one level above WEB-INF).

I want to put test.jsp, somewhere else... like WEB-INF/jsp...

Is that possible? I guess it is not necessary as I just figured out that I could block direct access to *.jsp using a security constraint in web.xml, but I guess I'd still like to know if it's possible.

Thanks!
 
Tim Holloway
Bartender
Posts: 18408
58
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
URLs are not the same thing as filesystem paths - they are Uniform Resource Locators. For convenience, in a lot of cases the levels of a URL may echo levels of directories in a filesystem tree, but they don't have to. In fact, neither branch nor tip of a URL path needs to actually exist as a file at all - they're just cues to the application on where and/or how to find and present things. No Struts app has any files whose names end in ".do" anywhere in the WAR, for example.

The web.xml file contains the URL decoding map for the application. It's what causes Struts ".do" URLs to be routed to the Struts servlet for processing by the appropriage Form Bean, Action, and View processors as determined by its reading of struct-config.xml. A similar mechanism is used with the JSF servlet.

So the answer is: you setup the web.xml to handle the URLs, subject to the URL naming constraints built into the jsf servlet.
 
Edgar Castanedo
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the feedback. I am not entirely new to Java web apps. I think I probably wasn't very good at explaining what I want to do.

In Spring you can configure your view resolver with a prefix:



Is there anything like that in JSF? I'd like to be able to put my JSP into whichever directory I specify in the config file....

Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!