【发布时间】:2020-09-20 18:56:19
【问题描述】:
目前我正在尝试以下 JSF - Lib:
https://www.ocpsoft.org/rewrite/examples/
我有以下问题:
我有一个页面: /page.jsf
在我的页面中,我的参数不止一个。 例如。我有: - 参数1 - 参数2
String parameter1 = FacesContext.getCurrentInstance().getExternalContext()
.getRequestParameterMap().get("parameter1");
String parameter2 = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap()
.get("parameter2");
目前我知道我可以在我的 UrlConfigProvider 类中添加它:
.addRule(Join.path("/page/{parameter1}").to("/portal/mypage.jsf") .withInboundCorrection())
这适用于一个参数。
但是我怎样才能对多个参数执行此操作,所以 URL 是: /page/{parameter1}/{parameter2} ....
有什么想法吗?
【问题讨论】:
-
这可能对你有帮助:ocpsoft.org/opensource/…
-
谢谢,不过应该是URL重写规则吧?
-
只是为了说清楚:你想用动态数量的参数重写
/page/p1/p2/p3/ ...到页面/portal/mypage.jsf?p1=?&p2=?&p3=?& ...? -
是的,正确.... 那我该如何调整规则呢? .addRule(Join.path("/page/{parameter1}").to("/portal/mypage.jsf") .withInboundCorrection())
标签: jsf dynamic path-parameter ocpsoft-rewrite