【问题标题】:Navigate to pages in different folders [duplicate]导航到不同文件夹中的页面[重复]
【发布时间】:2016-07-20 10:39:38
【问题描述】:

我使用这个 html 代码导航到 JSF 页面:

<a href="NewCustomer.xhtml">New Customer</a>

这个 JSF 代码运行良好

<h:outputLink value="NewCustomer.xhtml" >
    New Customer
</h:outputLink>

但是当我在不同的文件夹中有页面时,这不起作用。

如何在不同文件夹中的页面之间导航?

当我点击链接时得到这个结果:

http://localhost:8085/Crm_site/Dashboard.xhtml

我在这里导航:

http://localhost:8085/customers/Customers.xhtml

但它应该在这里

http://localhost:8085/Crm_site/customers/Customers.xhtml

【问题讨论】:

  • 但是会发生什么呢?二战?什么是生成的客户端? “不工作”不是开发人员应该报告的事情

标签: jsf jsf-2.2


【解决方案1】:

在页面名称之前添加上下文路径

#{request.contextPath}/customers/Customers.xhtml

或者您可以使用外部上下文从支持 bean 导航

 FacesContext.getCurrentInstance().getExternalContext().redirect(url)

【讨论】:

    猜你喜欢
    • 2021-12-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-10
    相关资源
    最近更新 更多