Organizing .xhtml files in subfolders

拈花ヽ惹草 提交于 2019-12-12 01:37:29

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!