我有一个 xhtml 页面,其中有一个带有 f:param 的输出链接
<h:outputLink value="#{formService.getStartFormData(v_process.id).formKey}">
Start
<f:param name="processDefinitionKey" value="#{v_process.key}"></f:param>
</h:outputLink>
在目标页面中,我有查看参数
f:metadata>
<!-- bind the key of the process to be started -->
<f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}"/>
</f:metadata>
我的豆是
@Named
@RequestScoped
public class ProcessList{
private String processDefinitionKey ;
@Inject
private RepositoryService repositoryService;
@Produces
@Named("processDefinitionList")
public List<ProcessDefinition> getProcessDefinitionList() {
return repositoryService.createProcessDefinitionQuery()
.list();
}
public void setProcessDefinitionKey(String processDefinitionKey1) {
System.out.println("setProcessDefinitionKey "+processDefinitionKey1);
this.processDefinitionKey = processDefinitionKey1;
}
public String getProcessDefinitionKey() {
System.out.println("getProcessDefinitionKey______ "+processDefinitionKey);
return processDefinitionKey;
}
}
processDefinitionKey 为 null ,setter 没有被调用,怎么回事?web.xml 或 faces-config.xml 中是否有任何配置要添加?在同一个项目中,我使用 primefaces 和 spring security
这是整个页面
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
template="/WEB-INF/templates/template.xhtml">
<ui:define name="metadata">
<f:metadata>
<!-- bind the key of the process to be started -->
<f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}" />
</f:metadata>
</ui:define>
<ui:define name="content">
谢谢回复,请问这个没用