我可以重定向到JSF中包含unicode字符的URL吗?
我可以这样重定向吗:我可以重定向到JSF中包含unicode字符的URL吗?,url,unicode,jsf-2.2,Url,Unicode,Jsf 2.2,我可以这样重定向吗: FacesContext context= FacesContext.getCurrentInstance(); String contextPath = context.getExternalContext().getRequestContextPath(); context.getExternalContext().redirect(contextPath+"/taşıma"); 当URL重写规则中已经定义了contextPath/taşıma时? 当我进入URLco
FacesContext context= FacesContext.getCurrentInstance();
String contextPath = context.getExternalContext().getRequestContextPath();
context.getExternalContext().redirect(contextPath+"/taşıma");
当URL重写规则中已经定义了contextPath/taşıma
时?
当我进入URL
contextPath/taşıma
时,它会进入页面transportation.xhtml
,没有问题,但在重定向中它没有问题。可以使用urlcoder
:
context.getExternalContext().redirect(contextPath+"/"+URLEncoder.encode(stringToEncode, "UTF-8"));