Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/amazon-s3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
JSF中的路由图_Jsf_Rewrite_Maproute - Fatal编程技术网

JSF中的路由图

JSF中的路由图,jsf,rewrite,maproute,Jsf,Rewrite,Maproute,我正在用JSF构建一个站点,我需要有以下URL: www.--.com/domain1/page.jsf www.--.com/domain2/page.jsf ... www.--.com/domainN/page.jsf 在ASP.NET中,我可以这样做: routes.MapRoute( name: "Default", url: "{domain}/{controller}/{action}/{id}", defaults: new { controller =

我正在用JSF构建一个站点,我需要有以下URL:

www.--.com/domain1/page.jsf
www.--.com/domain2/page.jsf
...
www.--.com/domainN/page.jsf

在ASP.NET中,我可以这样做:

routes.MapRoute(
    name: "Default",
    url: "{domain}/{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional });
我试过这样使用:

.addRule(Join.path("/{domain}/clients/{page}").to("/clients/{page}.jsf"));
但效果却不一样。 例如,当使用以下命令重定向到beans方法内的另一个页面时:

return "page?faces-redirect=true";
由生成的url不包含域部分。我也无法从请求url获取域部分,因为它不在那里。 我还可以如何实现这一点


谢谢

为什么不使用return“/域/页面?faces redirect=true”;?我无法在bean中获取域。从外部上下文获取请求将返回一个不带/domain/part的url,因为它已被重写api更改。我还尝试使用request.getAttribute(“javax.servlet.forward.request_uri”);但有时它是空的,idk为什么。