【问题标题】:Unable to find or serve resource, /Directory1/Myproject/index.xhtml无法找到或提供资源,/Directory1/Myproject/index.xhtml
【发布时间】:2014-09-13 12:11:18
【问题描述】:

我有一个注销功能,可以实现当前会话中用户的注销。可以从位于我项目中各个目录的许多不同页面调用此函数。我希望在调用该函数后,将用户重定向到索引页面。但我无法做到这一点。我知道重定向取决于函数的返回字符串,但似乎这个字符串是指当前目录。

例如

Myproject
-index.xhtml
--Directory1
---page1.xhtml (this page is located in the Directory1-subdirectory of Myproject)

函数是这样的:

String logout(){
..
return "Myproject/index.xhtml"
}

只要从 index.xhtml 调用它就可以正常工作

而当我从 page1.xhtml 调用它时,它不适用于消息:

无法找到或提供资源,/Directory1/Myproject/index.xhtml。

有什么办法可以使这项工作或我应该换一种方式吗?

【问题讨论】:

    标签: jsf navigation


    【解决方案1】:

    尝试添加'/'

    String logout(){ .. return "/Myproject/index.xhtml" }

    【讨论】:

      猜你喜欢
      • 2014-06-30
      • 1970-01-01
      • 1970-01-01
      • 2018-08-01
      • 2016-10-09
      • 2011-12-23
      • 1970-01-01
      • 2013-11-11
      • 2014-08-21
      相关资源
      最近更新 更多