【问题标题】:pass to another jsf page [duplicate]传递到另一个jsf页面[重复]
【发布时间】:2017-08-20 00:16:00
【问题描述】:

我正在尝试将参数从 jsf 页面传递到另一个页面,但我调用的另一个页面甚至不会更改 URl,它只是将“#”添加到现有 url 中。 这是 index.xhtml

        <h:commandLink value="details" action="#{ideeBean.details()}">
                  <f:param name="idee" value="in" />
              </h:commandLink>

这是IdeeBean.java

 public String details(){

      return "details";
  }

当我单击命令链接时,url 从 :http://localhost:8080/gidee/ 传递到 http://localhost:8080/gidee/#

【问题讨论】:

  • 您需要h:outputLink 使用f:param 参数,或h:commandLink action="#{ideeBean.details(yourParameterValue1, yourParameterValue2)}" 将参数传递给您的操作方法。
  • 我想传递给 url localhost:8080/gidee/details.xhtml 所以 index.xhtml 中的方法 details() 是正确的吗?因为它传递给localhost:8080/gidee/#

标签: jsf


【解决方案1】:

为了更改网址,您需要在操作完成后进行重定向。

【讨论】:

  • redirect 你的意思是我应该在 details 方法中使用 return "details?faces-redirect=true" 吗?我也尝试过,但没有任何改变
  • 是的,结果“details”的映射应该是 faces-config 中的“details.xhtml”,或者操作方法应该返回 details.xhtml?faces-redirect=true。
猜你喜欢
  • 1970-01-01
  • 2016-01-24
  • 1970-01-01
  • 2016-12-30
  • 2012-11-07
  • 1970-01-01
  • 1970-01-01
  • 2013-11-21
  • 1970-01-01
相关资源
最近更新 更多