简体   繁体   English

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

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

I have a log-out function that implements logout of the user currently in session. 我有一个注销功能,用于实现会话中当前用户的注销。 This function can be called from many different pages located to various directories in my project. 可以从位于项目中各个目录的许多不同页面调用此函数。 I want , after the function is called , the user to be redirected to the index page. 我想要在函数调用之后将用户重定向到索引页面。 But I cannot achieve this. 但是我无法做到这一点。 I know that redirection depends on the return string of the function, but it seems that this string is referring to the current directory. 我知道重定向取决于函数的返回字符串,但似乎此字符串引用的是当前目录。

Eg 例如

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

The function is this: 函数是这样的:

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

which works fine as long as it is called from the index.xhtml 只要从index.xhtml调用它就可以正常工作

whereas when I call it from the page1.xhtml it doens't work with message: 而当我从page1.xhtml调用它时,它不支持消息:

Unable to find or serve resource, /Directory1/Myproject/index.xhtml. 无法找到或提供资源/Directory1/Myproject/index.xhtml。

is there any way to make this work or should I go for another way? 有什么方法可以使这项工作奏效,还是我应该另辟way径?

尝试添加'/'

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

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

相关问题 在ExternalContext中找不到/index.xhtml作为资源 - /index.xhtml Not Found in ExternalContext as a Resource 404 /index.xhtml在ExternalContext中找不到作为资源 - 404 /index.xhtml Not Found in ExternalContext as a Resource 在JSF中找不到index.xhtml资源 - index.xhtml resource not found in JSF 无法找到与 from-view-id &#39;/pages/index.xhtml&#39; 匹配的导航案例 - Unable to find matching navigation case with from-view-id '/pages/index.xhtml' 无法找到具有from-view-id&#39;/index.xhtml&#39;的匹配导航案例:JSF - Unable to find matching navigation case with from-view-id '/index.xhtml' for action : JSF JSF无法找到具有from-view-id&#39;/index.xhtml&#39;的匹配导航案例 - JSF Unable to find matching navigation case with from-view-id '/index.xhtml' for action welcome-file index.xhtml提供“在ExternalContext中找不到”作为资源 - welcome-file index.xhtml gives Not Found in ExternalContext as a Resource com.sun.faces.context.FacesFileNotFoundException:/protected-area/index.xhtml在ExternalContext中找不到作为资源 - com.sun.faces.context.FacesFileNotFoundException: /protected-area/index.xhtml Not Found in ExternalContext as a Resource Primefaces 和 Jboss 的 index.xhtml 404 错误 - index.xhtml 404 error with Primefaces and Jboss <h:outputText> index.xhtml无法在浏览器中呈现 - <h:outputText> of index.xhtml not rendering in the browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM