niamat
niamat

Reputation: 31

f:param and f:viewparam setter not called

I have a xhtml page where i have an outputlink with f:param

<h:outputLink value="#{formService.getStartFormData(v_process.id).formKey}"> Start <f:param name="processDefinitionKey" value="#{v_process.key}"></f:param> </h:outputLink>

in the target page , i have view param

f:metadata>
        <!-- bind the key of the process to be started -->
        <f:viewParam name="processDefinitionKey" value="#{processList.processDefinitionKey}"/> 

    </f:metadata>

my bean is

@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 is null , the setter is not called , what's wrong ? are there any configurations in web.xml or faces-config.xml to add? in the same project i work with primefaces and spring security

this is the whole page

<?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">      

Thank you for replying , please this did not work

Upvotes: 3

Views: 2013

Answers (2)

Aron Rodrigues
Aron Rodrigues

Reputation: 31

It's a JEE7 bug. https://java.net/jira/browse/JAVASERVERFACES-2868 As a work as a workaround I put:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:oldf="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/templates/template.xhtml">
<oldf:metadata>
    <oldf:viewAction action="#{chooseRoleBean.init()}" />
</oldf:metadata>

Upvotes: 1

timmornYE
timmornYE

Reputation: 728

Try to change the namespaces like posted already here. In my case (glassfish 4.0) and in the case linked, it had to be

xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"

but try

xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"

Which worked on Tomcat for me.

If someone has an idea why this is this way, I would be happy to here. Second variant should be the correct one what I read here.

Upvotes: 2

Related Questions