【发布时间】:2016-03-21 14:29:00
【问题描述】:
我正在开发 jsf 项目。我想删除 URL 中的项目名称。我想要http://localhost:8080 而不是http://localhost:8080/simpleJSF1/。问题出在我的 java 代码中,我必须编写项目名称才能重定向到另一个页面,就像这样。
FacesContext.getCurrentInstance().getExternalContext().redirect("/simpleJSF1/login.xhtml");
如果我能够以某种方式从 url 中删除项目名称,那么我可以这样写
FacesContext.getCurrentInstance().getExternalContext().redirect("/login.xhtml");
而不是
FacesContext.getCurrentInstance().getExternalContext().redirect("/simpleJSF1/login.xhtml");
任何帮助将不胜感激。提前致谢。
【问题讨论】:
-
等等,你只是想根据分隔符分割一个字符串?
-
不,我想当我运行项目并输入localhost:8080 我的项目应该运行。现在要运行项目,我需要在端口号之后输入项目名称,例如localhost:8080/simpleJSF1。其中 simpleJSF1 是我的项目名称。
标签: jsf