我正在使用Primefaces 6.0
and JSF 2.3
,我将 String 作为参数传递,但它变成了空的!爪哇:
FacesContext context = FacesContext.getCurrentInstance();
ExternalContext extContext = context.getExternalContext();
String redirected = extContext.encodeActionURL(context.getApplication().getViewHandler().getActionURL(context, url));
URIBuilder builder = new URIBuilder(redirected);
builder.addParameter("action", "A")
extContext.getFlash().setKeepMessages(true);
extContext.redirect(builder.toString());
XHTML:
......
<f:metadata>
<f:viewParam name="action" value="#{mybean.action}" />
</f:metadata>
.......
当我通过 Boolean 或 Long 时,它工作正常,下面是一个 Long 示例:
<f:viewParam name="id" value="#{mybean.id}" converter="javax.faces.Long" />