我有一個XHTML頁面,我有使用f一個outputLink的:在目標頁面PARAMF:PARAM和f:viewparam二傳手不叫
<h:outputLink value="#{formService.getStartFormData(v_process.id).formKey}"> Start <f:param name="processDefinitionKey" value="#{v_process.key}"></f:param> </h:outputLink>
,我有鑑於PARAM
f:metadata>
<!-- bind the key of the process to be started -->
<f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}"/>
</f:metadata>
我bean是
@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爲空,二傳不叫 , 怎麼了 ? 有沒有在web.xml或faces-config.xml中添加任何配置? 在同一個項目中,我與primefaces和春季安全
工作,這是整個頁面
<?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">
感謝您的回覆,請這並不工作
我認爲你缺少的setter此方法:'公開名單 getProcessDefinitionList()'。你可以試試嗎? –
@cacho:在這個特殊情況下,爲什麼要爲這個屬性設置一個setter? – BalusC
@BalusC:因爲我認爲代碼代表一個JSF Java Bean,因此它需要爲每個屬性設置一個getter/setter,對吧? –