在子文件夹中组织.xhtml文件 [英] Organizing .xhtml files in subfolders

查看:73
本文介绍了在子文件夹中组织.xhtml文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有许多.xhtml文件的JSF 2.0项目.由于使用了安全过滤器,我想将一些文件放在/secure文件夹中,然后再启用该过滤器.

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"

"/selectRole.xhtml Not Found in ExternalContext as a Resource"

我需要在faces-config或web.xml中添加一些内容吗?

Do I need to add something to the faces-config or web.xml?

推荐答案

您的应用程序正尝试从Bean读取/selectRole.xhtml或重定向操作.

Your application is trying to read /selectRole.xhtml from a bean, or redirect action.

在JSF2中,导航规则是在Bean中编写的.该方法的返回字符串,可以相对于WebContent文件夹返回文件的位置.

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.

请注意,尽管不建议这样做,它也可能会出现在faces-config.xml文件中.

Please note, that it may appear also in faces-config.xml file, though is not recommended.

查看您在哪里声明了它(通常在重定向到它的bean文件中)并将其更改为返回"/secure/selectRole"

Look where you have declared it, (usually in the bean file that redirects to it) and change it to return "/secure/selectRole"

例如:

Public class myBean{
  public String save(){
    return "/secure/selectRole";
   }
}

我能想到的另一个地方是另一个.xhtml文件-在h:link中,您链接到此页面.

Another place where I can think of, is in another .xhtml file - where in h:link you link to this page.

这篇关于在子文件夹中组织.xhtml文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆