pessoal tenho a seguinte classe:
[code]/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package br.com.dnasolution.bean;
import br.com.dnasolution.db.Conexao;
import java.sql.Connection;
import java.sql.Date;
import java.sql.PreparedStatement;
import java.util.GregorianCalendar;
/**
*
-
@author Fabio Ebner
*/
public class AnseioBean {private int codigoPessoa = 0;
private String descricaoAnseio = null;
private int codigoPessoaSupport;
private GregorianCalendar dataAnseio = null;
static final String SUCESSO_INSERIR = “success”;
static final String FALHA_INSERIR = “failure”;
static String retorno = null;
Connection con = null;
PreparedStatement pStm = null;/** Creates a new instance of AnseioBean */
public AnseioBean() {
dataAnseio = new GregorianCalendar();
}public String inserir() {
try {
con = Conexao.getInstancia().conectarDb();
pStm = con.prepareStatement(“INSERT INTO tb_anseio (cd_pessoa,ds_anseio,dt_anseio) VALUES (?,?,?)”);
pStm.setInt(1, codigoPessoaSupport);
pStm.setString(2, descricaoAnseio);
pStm.setDate(3, new Date(dataAnseio.getTimeInMillis()));
System.out.println(pStm.toString());
pStm.execute();
retorno = SUCESSO_INSERIR;
con.commit();
con.close();
pStm.close();
} catch (Exception e) {
System.out.println("aee " + e.getMessage());
retorno = FALHA_INSERIR;
}
return retorno;
}public int getCodigoPessoa() {
return codigoPessoa;
}public void setCodigoPessoa(int codigoPessoa) {
this.codigoPessoa = codigoPessoa;
}public String getDescricaoAnseio() {
return descricaoAnseio;
}public void setDescricaoAnseio(String descricaoAnseio) {
this.descricaoAnseio = descricaoAnseio;
}public void setDataAnseio(GregorianCalendar dataAnseio) {
this.dataAnseio = dataAnseio;
}public GregorianCalendar getDataAnseio() {
return dataAnseio;
}public String getDataAnseios() {
return dataAnseio.get(GregorianCalendar.DATE) + “/” + (dataAnseio.get(GregorianCalendar.MONTH) + 1) + “/” + dataAnseio.get(GregorianCalendar.YEAR);
}public int getCodigoPessoaSupport() {
return codigoPessoaSupport;
}public void setCodigoPessoaSupport(int codigoPessoaSupport) {
this.codigoPessoaSupport = codigoPessoaSupport;
}public String inserirCodigo(){
this.codigoPessoa = codigoPessoaSupport;
return “”;
}
}
[/code]
e o seguinte JSP
[code]<%@ taglib prefix=“f” uri=“http://java.sun.com/jsf/core” %>
<%@ taglib prefix=“h” uri=“http://java.sun.com/jsf/html” %>
<%@ taglib uri=“http://richfaces.org/rich” prefix=“rich”%>
<%@ taglib uri=“http://richfaces.org/a4j” prefix=“a4j”%>
<f:view>
Untitled Document
function adicionaCodigo(codigo){
var objCodigoPessoa = document.getElementById(‘formulario:hdCodigoPessoa’);
objCodigoPessoa.value = codigo;
}
</script>
</head>
<body>
<h:form id="formulario">
<table width="780" align="center" cellpadding="0" cellspacing="0" border="0">
<tr>
<th width="170" rowspan="2" valign="top" scope="col"><img src="../imagens/topo_logo.jpg" width="170" height="190" /></th>
<th width="610" height="57" colspan="2" valign="top" background="../imagens/topo.jpg" scope="col"><table width="100%" height="55" border="0" cellpadding="0" cellspacing="0">
<tr>
<th height="19" scope="col"> </th>
<th scope="col"> </th>
<th scope="col"> </th>
</tr>
<tr>
<th colspan="3" scope="row"> </th>
</tr>
</table>
</th>
</tr>
<tr>
<td colspan="2" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="fonte">
<tr>
<td colspan="2" class="fonte"><strong>Cadastro de Anseios da População</strong></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td height="25"><strong><h:outputLink value="javascript:void(0);" onclick="Richfaces.showModalPanel('mp',{width:450, top:200})">Pessoa:</h:outputLink></strong></td>
<td>
<h:inputText value="#{montaCombo.nomePessoa}" id="text" styleClass="borda_cinza"/>
<rich:suggestionbox id="suggestionBoxId" for="text"
suggestionAction="#{montaCombo.complemento}"
width="200" height="150" var="result"
fetchValue="#{result.nm_pessoa}"
nothingLabel="Nenhum nome encontrado" >
<h:column>
<f:facet name="header">
<h:outputText value="123"></h:outputText>
</f:facet>
</h:column>
<h:column>
<h:outputLink value="javascript:void(0);" onclick="adicionaCodigo(#{result.cd_pessoa})">
<h:outputText value="#{result.nm_pessoa}" />
</h:outputLink>
</h:column>
<h:column>
<h:outputText value="#{result.nm_ocupacao}" style="font-style:italic" />
</h:column>
<a4j:support event="onselect" action="#{anseio.codigoPessoaSupport}">
<f:setPropertyActionListener value="#{result.cd_pessoa}" target="#{anseio.codigoPessoaSupport}" />
</a4j:support>
</rich:suggestionbox>
<h:inputHidden id="hdCodigo" value="#{anseio.codigoPessoa}"/>
</td>
</tr>
<tr>
<td width="25%" height="25">Descrição:</td>
<td width="75%"><h:inputTextarea value="#{anseio.descricaoAnseio}" id="descricao" styleClass="borda_cinza" cols="50" rows="5" /></td>
</tr>
<tr>
<td height="25">Data:</td>
<td>
<a4j:outputPanel id="calendario" layout="block" >
<rich:calendar value="#{anseio.dataAnseio.time}"
popup="true"
datePattern="dd/MM/yyyy"
showApplyButton="false"/>
</a4j:outputPanel>
</td>
</tr>
<tr>
<td> </td>
<td>
</td>
</tr>
<tr>
<td> </td>
<td><h:commandButton value="Cadastrar" action="#{anseio.inserir}" styleClass="borda_cinza"/> </td>
</tr>
</table>
</td>
</tr>
</table>
</h:form>
<%@ include file="../cadastro_auxiliar/cadastro_pessoa.jsp" %>
</body>
</html>
</f:view>
[/code]
porem qdo ele esta me retornando esse erro qdo seleciono um item na suggestionbox
[quote]HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: #{anseio.codigoPessoaSupport}: javax.el.MethodNotFoundException: Method not found: br.com.dnasolution.bean.AnseioBean@79b37.codigoPessoaSupport()
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
root cause
javax.faces.FacesException: #{anseio.codigoPessoaSupport}: javax.el.MethodNotFoundException: Method not found: br.com.dnasolution.bean.AnseioBean@79b37.codigoPessoaSupport()
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:99)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
javax.faces.component.UIData.broadcast(UIData.java:854)
org.richfaces.component.UISuggestionBox.broadcast(UISuggestionBox.java:293)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
root cause
javax.faces.el.MethodNotFoundException: javax.el.MethodNotFoundException: Method not found: br.com.dnasolution.bean.AnseioBean@79b37.codigoPessoaSupport()
com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:81)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
javax.faces.component.UIData.broadcast(UIData.java:854)
org.richfaces.component.UISuggestionBox.broadcast(UISuggestionBox.java:293)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
root cause
javax.el.MethodNotFoundException: Method not found: br.com.dnasolution.bean.AnseioBean@79b37.codigoPessoaSupport()
org.apache.el.util.ReflectionUtil.getMethod(ReflectionUtil.java:138)
org.apache.el.parser.AstValue.invoke(AstValue.java:128)
org.apache.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
com.sun.faces.application.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
javax.faces.component.UICommand.broadcast(UICommand.java:383)
org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:61)
javax.faces.component.UIData.broadcast(UIData.java:854)
org.richfaces.component.UISuggestionBox.broadcast(UISuggestionBox.java:293)
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.14 logs.
Apache Tomcat/6.0.14[/quote]
nessa linha de erro:
[quote]javax.servlet.ServletException: #{anseio.codigoPessoaSupport}: javax.el.MethodNotFoundException: Method not found: br.com.dnasolution.bean.AnseioBean@79b37.codigoPessoaSupport()
[/quote] eu nao entendi pq ele colocou o @79b37 ali… alguem pde me ajudar??
valeus