繁体   English   中英

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

[英]Unable to find or serve resource, /Directory1/Myproject/index.xhtml

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

例如

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。

有什么方法可以使这项工作奏效,还是我应该另辟way径?

尝试添加'/'

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM