Solucionado (ver solução)
Solucionado
(ver solução)
6
respostas

Passagem de Parâmetro via URL JSF

Srs, boa noite!

Eu estou tentando realizar uma passagem de parâmetro via URL com JSF. Tenho duas páginas são elas,

formBonus, responsável por passar os dados via URL. dadosBonus, responsável por pegar as informações da URL e, efetuar a chamada para minha classe controle que contém um método que efetua um calculo.

O erro que está sendo apresentado é " Tag Library supports namespace: http://java.sun.com/jsf/core". Eu fiz uma busca na web e achei um novo pacote para essa tag: "xmlns:f="http://xmlns.jcp.org/jsf/core", mas se eu uso esse pacote um erro de nullPointerException é apresentado no meu método "calcula".

Segue meu fonte, junto com as configurações do meu arquivo xml e console com as chamadas no servidor. Obrigado.

ARQUIVO FORMBONUS
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">

<h:head>
    <title>Form Bonus</title>
</h:head>
<h:body>
    <h:link outcome="dadosBonus" value="Calcular" includeViewParams="true">
        <f:param name="c" value="0" />
        <f:param name="n" value="Leandro" />
        <f:param name="s" value="1000.0" />

    </h:link>
</h:body>
</html>
ARQUIVO DADOSBONUS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:ui="http://java.sun.com/jsf/facelets">

<f:view>
    <f:metadata>
        <!-- Vincula os "nomes"(parametros, via URL) aos metodos da classe controleBonus -->
        <f:viewParam name="c" value="#{controleBonus.cargo}" />
        <f:viewParam name="n" value="#{controleBonus.nome}" />
        <f:viewParam name="s" value="#{controleBonus.salario}" />
        <!-- Executa uma acção para calcular o bonus -->
        <f:viewAction action="#{controleBonus.calcula()}" />
    </f:metadata>
    <h:head>
        <title>Dados Bonus</title>
    </h:head>
    <h:body>
        <h:panelGrid columns="2">
            <h:outputLabel value="Nome: " />
            <h:outputLabel value="#{controleBonus.nome}" />
            <h:outputLabel value="Salario: " />
            <h:outputLabel value="#{controleBonus.salario}" />
            <h:outputLabel value="Bonus: " />
            <h:outputLabel value="#{controleBonus.calcula()}" />
        </h:panelGrid>
    </h:body>
</f:view>
</html>
CONTROLE
package Controle;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

@ManagedBean(name = "controleBonus")
@RequestScoped
public class ControleBonus implements Serializable {

    private String nome;
    private Double salario;
    private Double bonus;
    private Integer cargo;

    // Construtor
    public ControleBonus() {

    }

    // CAL OF BONUS
    public String calcula() {

        switch (cargo) {
        case 0:
            bonus = salario * 15 / 100;
            break;

        case 1:
            bonus = salario * 10 / 100;
            break;

        case 3:
            bonus = salario * 10 / 100;
            break;

        }
        return "dadosBonus";
    }

    public String getNome() {
        return nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    public Double getSalario() {
        return salario;
    }

    public void setSalario(Double salario) {
        this.salario = salario;
    }

    public Double getBonus() {
        return bonus;
    }

    public void setBonus(Double bonus) {
        this.bonus = bonus;
    }

    public Integer getCargo() {
        return cargo;
    }

    public void setCargo(Integer cargo) {
        this.cargo = cargo;
    }

}
ARQUIVO XML
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
 xmlns="http://java.sun.com/xml/ns/javaee"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
 <display-name>PrimeiraAppComJSF2</display-name>
 <context-param>
  <param-name>javax.faces.PROJECT_STAGE</param-name>
  <param-value>Development</param-value>
 </context-param>
 <context-param>
  <description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>client</param-value>
 </context-param>
 <context-param>
  <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
  <param-value>resources.application</param-value>
 </context-param>
 <servlet>
  <servlet-name>Faces Servlet</servlet-name>
  <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 <servlet-mapping>
  <servlet-name>Faces Servlet</servlet-name>
  <url-pattern>*.xhtml</url-pattern>
 </servlet-mapping>
 <welcome-file-list>
      <welcome-file>index.xhtml</welcome-file>
 </welcome-file-list>
</web-app>

MENSAGEM DE ERRO USANDO O PACOTE "xmlns:f="http://java.sun.com/jsf/core" COM A TAG "<f:viewAction action="#{controleBonus.calcula()}" />"
Ago 25, 2015 9:58:57 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
GRAVE: Error Rendering View[/formBonus.xhtml]
javax.faces.view.facelets.TagException: /dadosBonus.xhtml @15,54 <f:viewAction> Tag Library supports namespace: http://java.sun.com/jsf/core, but no tag was defined for name: viewAction
    at com.sun.faces.facelets.compiler.CompilationManager.pushTag(CompilationManager.java:304)
    at com.sun.faces.facelets.compiler.SAXCompiler$CompilationHandler.startElement(SAXCompiler.java:257)
    at com.sun.faces.facelets.compiler.SAXCompiler$MetadataCompilationHandler.startElement(SAXCompiler.java:367)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.emptyElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at com.sun.faces.facelets.compiler.SAXCompiler.doCompile(SAXCompiler.java:425)
    at com.sun.faces.facelets.compiler.SAXCompiler.doMetadataCompile(SAXCompiler.java:410)
    at com.sun.faces.facelets.compiler.Compiler.metadataCompile(Compiler.java:130)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.createMetadataFacelet(DefaultFaceletFactory.java:326)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.access$200(DefaultFaceletFactory.java:92)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:165)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory$2.newInstance(DefaultFaceletFactory.java:163)
    at com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:94)
    at com.sun.faces.facelets.impl.DefaultFaceletCache$2.newInstance(DefaultFaceletCache.java:89)
    at com.sun.faces.util.ExpiringConcurrentCache$1.call(ExpiringConcurrentCache.java:99)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at com.sun.faces.util.ExpiringConcurrentCache.get(ExpiringConcurrentCache.java:114)
    at com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:143)
    at com.sun.faces.facelets.impl.DefaultFaceletCache.getViewMetadataFacelet(DefaultFaceletCache.java:62)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:259)
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:208)
    at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:113)
    at com.sun.faces.application.view.MultiViewHandler.addViewParameters(MultiViewHandler.java:548)
    at com.sun.faces.application.view.MultiViewHandler.getFullParameterList(MultiViewHandler.java:523)
    at com.sun.faces.application.view.MultiViewHandler.getBookmarkableURL(MultiViewHandler.java:351)
    at com.sun.faces.renderkit.html_basic.OutcomeTargetRenderer.getEncodedTargetURL(OutcomeTargetRenderer.java:167)
    at com.sun.faces.renderkit.html_basic.OutcomeTargetLinkRenderer.renderAsActive(OutcomeTargetLinkRenderer.java:158)
    at com.sun.faces.renderkit.html_basic.OutcomeTargetLinkRenderer.encodeBegin(OutcomeTargetLinkRenderer.java:96)
    at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1777)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
MENSAGEM DE ERRO USANDO O NOVO PACOTE "xmlns:f="http://xmlns.jcp.org/jsf/core"
Ago 25, 2015 10:06:12 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
ADVERTÊNCIA: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:PrimeiraAppComJSF2' did not find a matching property.
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server version:        Apache Tomcat/7.0.57
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server built:          Nov 3 2014 08:39:16 UTC
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Server number:         7.0.57.0
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Name:               Windows 8.1
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: OS Version:            6.3
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Architecture:          x86
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JAVA_HOME:             C:\Program Files (x86)\Java\jre7
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Version:           1.7.0_67-b01
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: JVM Vendor:            Oracle Corporation
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_BASE:         C:\Users\hendrix\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: CATALINA_HOME:         C:\apache-tomcat-7.0.57
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.base=C:\Users\hendrix\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dcatalina.home=C:\apache-tomcat-7.0.57
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dwtp.deploy=C:\Users\hendrix\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Djava.endorsed.dirs=C:\apache-tomcat-7.0.57\endorsed
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.VersionLoggerListener log
INFORMAÇÕES: Command line argument: -Dfile.encoding=Cp1252
Ago 25, 2015 10:06:12 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFORMAÇÕES: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jre7\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre7/bin/client;C:/Program Files (x86)/Java/jre7/bin;C:/Program Files (x86)/Java/jre7/lib/i386;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x86;C:\Program Files (x86)\Intel\OpenCL SDK\3.0\bin\x64;C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files\Java\jdk1.8.0_05\;C:\Maven\apache-maven-3.1.1\bin;C:\Program Files\Java\jdk1.8.0_05\bin;C:\Program Files (x86)\Skype\Phone\;C:\eclipse;;.
Ago 25, 2015 10:06:12 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["http-bio-8080"]
Ago 25, 2015 10:06:12 PM org.apache.coyote.AbstractProtocol init
INFORMAÇÕES: Initializing ProtocolHandler ["ajp-bio-8009"]
Ago 25, 2015 10:06:12 PM org.apache.catalina.startup.Catalina load
INFORMAÇÕES: Initialization processed in 436 ms
Ago 25, 2015 10:06:12 PM org.apache.catalina.core.StandardService startInternal
INFORMAÇÕES: Starting service Catalina
Ago 25, 2015 10:06:12 PM org.apache.catalina.core.StandardEngine startInternal
INFORMAÇÕES: Starting Servlet Engine: Apache Tomcat/7.0.57
Ago 25, 2015 10:06:14 PM com.sun.faces.config.ConfigureListener contextInitialized
INFORMAÇÕES: Inicializando Mojarra 2.1.14 ( 20121023-1153) para o contexto '/PrimeiraAppComJSF2'
Ago 25, 2015 10:06:14 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFORMAÇÕES: JSF1048: Anotações PostConstruct/PreDestroy presentes.  Os métodos ManagedBeans marcados com essas anotações informarão as anotações processadas.
Ago 25, 2015 10:06:15 PM org.primefaces.webapp.PostConstructApplicationEventListener processEvent
INFORMAÇÕES: Running on PrimeFaces 3.4.2
Ago 25, 2015 10:06:15 PM com.sun.faces.config.ConfigureListener$WebConfigResourceMonitor$Monitor <init>
INFORMAÇÕES: Monitoring jndi:/localhost/PrimeiraAppComJSF2/WEB-INF/faces-config.xml for modifications
Ago 25, 2015 10:06:15 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["http-bio-8080"]
Ago 25, 2015 10:06:15 PM org.apache.coyote.AbstractProtocol start
INFORMAÇÕES: Starting ProtocolHandler ["ajp-bio-8009"]
Ago 25, 2015 10:06:15 PM org.apache.catalina.startup.Catalina start
INFORMAÇÕES: Server startup in 2490 ms
Ago 25, 2015 10:06:34 PM com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
GRAVE: Error Rendering View[/dadosBonus.xhtml]
javax.el.ELException: /dadosBonus.xhtml: java.lang.NullPointerException
    at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:94)
    at com.sun.faces.facelets.compiler.UIInstructions.encodeBegin(UIInstructions.java:82)
    at com.sun.faces.facelets.compiler.UILeaf.encodeAll(UILeaf.java:183)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1782)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:437)
    at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:124)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:120)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at Controle.ControleBonus.calcula(ControleBonus.java:25)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.el.BeanELResolver.invoke(BeanELResolver.java:183)
    at javax.el.CompositeELResolver.invoke(CompositeELResolver.java:161)
    at org.apache.el.parser.AstValue.getValue(AstValue.java:173)
    at org.apache.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:184)
    at com.sun.faces.facelets.el.ELText$ELTextVariable.toString(ELText.java:217)
    at com.sun.faces.facelets.compiler.AttributeInstruction.write(AttributeInstruction.java:89)
    ... 29 more
6 respostas

Oi Leandro, vc deve usar os novos namespaces xmlns:f="http://xmlns.jcp.org/jsf/core" como falou.

Tem como colocar a exception com esse novo namespace?

abs

Nico, boa noite!

Obrigado pelo seu breve retorno. Pelo que entendi eu tenho que usar esse namespaces, ótimo.

Eu havia feito isso e um novo erro é apresentado no meu metodo controller, um erro de "javax.el.ELException: /dadosBonus.xhtml: java.lang.NullPointerException".

Eu devo capturar esse erro e trata-lo no meu método?

Agora vi que vc já tinha postado a outra exceção!

Repare que deu:

Caused by: java.lang.NullPointerException
    at Controle.ControleBonus.calcula(ControleBonus.java:25)

Na linha 25 da classe ControleBonus foi gerado uma NullPointerException. Me parece que a passada dos parâmetros via GET não funcionou. No método calcula imprime uma vez os param (ou faça um debug) para verficar se o bean realmente recebe os params, ok?

abs

Oi Nico!

Você estava certo meu controle não está recebendo os parâmetros contidos na URL. Eu fiz a inclusão dos valores via método construtor e erro de nulPointerException desapareceu.

Porem eu estou com erro na minha página web, esse erro:

"Warning: This page calls for XML namespace http://xmlns.jcp.org/jsf/core declared with prefix f but no taglibrary exists for that namespace."

Eu estou usando a biblioteca javafaces-2.1.14, erro pode ser por esse motivo?

solução!

Oi Nico,

eu consegui resolver o erro acima. Eu importei a versão 2.2.3 do jar, eu estava usando a versão 2.1.14.

Uma observação importante é que mesmo com o jar que suporta a tag eu permaneço utilizando o namespace "xmlns:f="http://java.sun.com/jsf/core".

Mais uma vez, obrigado pela ajuda. Tenha uma ótima semana!

Vlw pelo retorno :)