问题
I have a JSF 2.0 project wiht lots of .xhtml files. Due to a security filter I want to put some of the files in a /secure folder to then aply the filter on.
I tried simply moving the files to a folder. But then I get an exception
"/selectRole.xhtml Not Found in ExternalContext as a Resource"
Do I need to add something to the faces-config or web.xml?
回答1:
Your application is trying to read /selectRole.xhtml
from a bean, or redirect action.
In JSF2, the navigation rules are written in the beans. The return String of the method, may return the location of the file relatively to WebContent folder.
EDIT:
Please note, that it may appear also in faces-config.xml
file, though is not recommended.
Look where you have declared it, (usually in the bean file that redirects to it) and change it to return "/secure/selectRole"
For example:
Public class myBean{
public String save(){
return "/secure/selectRole";
}
}
Another place where I can think of, is in another .xhtml file - where in h:link you link to this page.
来源:https://stackoverflow.com/questions/3440538/organizing-xhtml-files-in-subfolders