简体   繁体   中英

f:viewAction don't invoke action

I´m using Weblogic server 12.1.2, JSF 2, Mojarra 2.2.4 and I have the next code in a page:

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://xmlns.jcp.org/jsf/html"
    xmlns:f="http://xmlns.jcp.org/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:p="http://primefaces.org/ui"
    xmlns:c="http://java.sun.com/jsp/jstl/core">

    <f:metadata>
        <f:viewAction action="#{sessionBean.solicitud()}" />
    </f:metadata>

    <h:body>
        Solicitud: '#{param.id}'
        From: '#{param.from}'
        <br />
    </h:body>
</html>

The SessionBean has the next method:

public String solicitud() {
    System.out.println("\n12\n");
    Long id = getRequestParam("id") != null ? Long.valueOf(getRequestParam("id")) : 0;

    String from = getRequestParam("from") != null ? getRequestParam("from") : "";
    System.out.println("*********** PASA POR AQUI 1 ***********************");
    if(id != null && id > 0){
        if(StringUtils.isNotBlank(from) && from.equals("informes")){
            System.out.println("*********** PASA POR AQUI 2 ***********************");
            return solicitud.cargarSolicitudInforme(id);
        }
        else{
            System.out.println("*********** PASA POR AQUI 4 ***********************");
            return solicitud.cargarSolicitud(id);
        }
    }
    else{
        System.out.println("*********** PASA POR AQUI 6 ***********************");
        return home();
    }
}

I changed namepaces xmlns: http://java.sun.com/jsf/core to xmlns: http://xmlns.jcp.org/jsf/core

If I run this application on a VMware vFabric tc Server v2.5, the app runs ok, but if I run it on a Weblogic server, the log doesn´t show error trace but the method is never executed.

what am I doing wrong?

Thanx.

Solved.

The problem was that the default jsf libraries on Weblogic server doesn´t recognize f:viewAction. The solution was to include the correct jsf libraries as shared jsf libraries (jsf-impl-2.2.4.jar and jsf-api-2.2.4.jar, in my case) in weblogic_domains/server_name/lib folder and delete them in the deployed war.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM