« Return to Thread: javax.servlet.ServletException: Error calling action method of component with id

javax.servlet.ServletException: Error calling action method of component with id

by logancillo :: Rate this Message:

Reply to Author | View in Thread

hi list, i`m newbee with jsf, it gives me this exception:

javax.servlet.ServletException: Error calling action method of component with id formulario:boton
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:152)
        org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)

causa raĆ­z

javax.faces.FacesException: Error calling action method of component with id formulario:boton
        org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
        de.mindmatters.faces.application.DelegatingActionListener.processAction(DelegatingActionListener.java:106)
        javax.faces.component.UICommand.broadcast(UICommand.java:106)
        org.ajax4jsf.framework.ajax.AjaxViewRoot.processEvents(AjaxViewRoot.java:274)
        org.ajax4jsf.framework.ajax.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:250)
        org.ajax4jsf.framework.ajax.AjaxViewRoot.processApplication(AjaxViewRoot.java:405)
        de.mindmatters.faces.lifecycle.InvokeApplicationPhase.executePhase(InvokeApplicationPhase.java:43)
        de.mindmatters.faces.lifecycle.AbstractPhase.execute(AbstractPhase.java:37)
        de.mindmatters.faces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:166)
        de.mindmatters.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:211)
        javax.faces.webapp.FacesServlet.service(FacesServlet.java:137)
        org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)


i`m using myfaces 1.1.4 with jdk 1.6, tomcat 5.5.17.

my web.xml is

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>/WEB-INF/faces-config.xml</param-value>
    </context-param>
    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>/WEB-INF/applicationContext.xml</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.verifyObjects</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.validateXml</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <session-config>
        <session-timeout>
            30
        </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>
            index.jsp
        </welcome-file>
    </welcome-file-list>
    <!-- listener de spring-->
    <listener>  
        <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>  
    </listener>
    <listener>
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
        <servlet-name>TilesServet</servlet-name>
            <servlet-class>org.apache.struts.tiles.TilesServlet</servlet-class>
            <init-param>
                <param-name>definitions-config</param-name>
                <param-value>/WEB-INF/tiles-defs.xml</param-value>
            </init-param>
            <load-on-startup>2</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.faces</url-pattern>
    </servlet-mapping>
   
</web-app>

my jsf is

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<f:view>
    <f:loadBundle basename="MessageResources" var="msg"/>
<head>
        <title>
            ${msg.titulo}
        </title>
</head>

<body>
    <h:form id="formulario">
        <h:inputText id="campoQue" value="#{yellProxy.campoQue}" />
        <h:inputText id="campoDonde" value="#{yellProxy.campoDonde}" />
        <h:commandButton id="boton" value="#{msg.boton}" action="#{yellProxy.encuentra}"/>
    </h:form>
</f:view>
</body>
</html>

yellPoxy.java

/*
 * YellProxy.java
 *
 * Created on 13 de septiembre de 2007, 11:59
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package es.yell.frontlite.servlets;

import java.util.Collection;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
import org.springframework.beans.factory.InitializingBean;
import es.yell.frontlite.service.impl.*;
import org.springframework.util.Assert;
/**
 * Esta clase va a hacer las siguientes acciones:
 * Averiguar quien es el cliente, IE, firefox, PDA.
 * Averiguar si tiene el js activado.
 * en funcion si tiene el js activado o no, redirijo la peticion a un servicio u otro
 * la peticion que hace el cliente
 * @author operador
 */
public class YellProxy{
   
    //campo que sirve para almacenar el resultado de la operacion que se hace en el cliente para ver si js esta activado.
    private String jsActivado;
    //campo que representa la identidad del navegador, IE, firefox...
    private String quienSoy;
    //campos que van a almacenar los campos que y donde de la pagina ppal.
    private String campoQue;
    //a este campo habra que destokenizar para rellenar los siguientes campos, direccion, localidad y cp
    private String campoDonde;
    //atributo que pasamos al servicio con los parametros que nos da el formulario de la jsp
    private BusquedaVO busquedaVO;
    //el servicio que nos da acceso a la capa de datos.INYECTADO
    private SrvBusquedaNoxtrumServiceImpl servicio;
    //atributo q contiene toda la informacion cuando utilizamos AJAX
    private String xml;
    //atributo q contiene toda la informacion cuando no utilizamos AJAX
    private Collection coleccion;
    /** Creates a new instance of YellProxy */
    public YellProxy() {
    }
    /**
     *Este metodo responde al evento del boton encuentra que esta en la pagina principal.
     *Basicamente va a destokenizar el campo campoDonde en los subcampos Direccion, localidad y CP.
     *Tambien y dependiendo de si el cliente tiene activado o no el js, ejecutaremos un servicio u otro.
    */
    public String encuentra(){
        //deja los atributos privados rellenos.
        String mensaje ;
        crearYRellenarBusquedaVO();
        //Javscript activado
        if (getJsActivado()!=null && getJsActivado().compareToIgnoreCase("S") == 0){
            //invocamos servicio adecuado
            setXml(this.getServicio().obtenerResultadosJSactivado(this.getBusquedaVO()));
            mensaje="succesJS";
        }else{
            //javascript no activado
            this.setColeccion(this.getServicio().obtenerResultadosJSdesactivado(this.getBusquedaVO()));
            mensaje="succesNoJS";
        }
       
        return mensaje;
    }

    private void crearYRellenarBusquedaVO() {
       
        if (busquedaVO == null){
            busquedaVO = new BusquedaVO();
        }
        busquedaVO.setCampoQue(this.getCampoQue());
        busquedaVO.setCampoDonde(this.getCampoDonde());
    }

    public String getCampoQue() {
        return campoQue;
    }

    public void setCampoQue(String campoQue) {
        this.campoQue = campoQue;
    }

    public String getCampoDonde() {
        return campoDonde;
    }

    public void setCampoDonde(String campoDonde) {
        this.campoDonde = campoDonde;
    }

    public String getJsActivado() {
        return jsActivado;
    }

    public void setJsActivado(String jsActivado) {
        this.jsActivado = jsActivado;
    }

    public String getQuienSoy() {
        return quienSoy;
    }

    public void setQuienSoy(String quienSoy) {
        this.quienSoy = quienSoy;
    }

    public BusquedaVO getBusquedaVO() {
        return busquedaVO;
    }

    public void setBusquedaVO(BusquedaVO busquedaVO) {
        this.busquedaVO = busquedaVO;
    }

    public String getXml() {
        return xml;
    }

    public void setXml(String xml) {
        this.xml = xml;
    }

    public Collection getColeccion() {
        return coleccion;
    }

    public void setColeccion(Collection coleccion) {
        this.coleccion = coleccion;
    }
   
    public SrvBusquedaNoxtrumServiceImpl getServicio() {
        return servicio;
    }

    public void setServicio(SrvBusquedaNoxtrumServiceImpl servicio) {
        this.servicio = servicio;
    }
   
}


thx in advance!

 « Return to Thread: javax.servlet.ServletException: Error calling action method of component with id