500 Action does not contain method named

Asked

Viewed 208 times

3

I’m making an action call but I get Exception that the method doesn’t exist in Action:

500 Action[/historicoAction] does not contain method named listar

Would anyone know what’s going on?

Follows files:

struts-config

<form-bean name="historicoForm" type="br.com.liquigas.portal.form.HistoricoForm"/>

<forward name="/historicoAction" path="/historicoAction.do"></forward>

<action path="/historicoAction" type="br.com.liquigas.portal.action.HistoricoAction" name="historicoForm" scope="request" parameter="method">
    <forward name="success" path="/jsp/historico/historicoPedido.jsp"></forward>
    <forward name="failure" path="/jsp/historico/erro.jsp"></forward>
    <forward name="historicoPedido" path="/jsp/historico/historicoPedido.jsp"></forward>
    <forward name="historicoProduto" path="/jsp/historico/historicoProduto.jsp"></forward>
</action>

JSP

<a class="ovalbutton" href="#" onclick="return avancar();"><span>Avan&ccedil;ar</span></a>

Javascript

function avancar(){
    $("#method").val("listar");
    $('#historicoForm').submit();
    alert("Avancou");
    return false;
}

FORM

public class HistoricoForm extends GenericForm {

    private static final long serialVersionUID = 7434349782026204632L;

    /**
     * Filtro da tela com o numero do pedido
     */
    private String numeroPedido;

    /**
     * Filtro da tela com o codigo do cliente
     */
    private String codigoCliente;

    /**
     * Filtro da tela com a Dta Inicial da pesquisa
     */
    private String dataInicial;

    /**
     * Filtro da tela com a Dta Final da pesquisa
     */
    private String dataFinal;

    /**
     * Lista com as informações do historico
     */
    private List historicoList;

    /**
     * Lista com as informações do Histórico do produto, a tela de detalhe do historico
     */
    private List historicoProdutoList;

    /**
     * parametro da jsp
     */
    private String method;

    /**
     * @return o numeroPedido
     */
    public String getNumeroPedido() {
        return numeroPedido;
    }

    /**
     * @param numeroPedido o numeroPedido a ser configurado
     */
    public void setNumeroPedido(String numeroPedido) {
        this.numeroPedido = numeroPedido;
    }

    /**
     * @return o codigoCliente
     */
    public String getCodigoCliente() {
        return codigoCliente;
    }

    /**
     * @param codigoCliente o codigoCliente a ser configurado
     */
    public void setCodigoCliente(String codigoCliente) {
        this.codigoCliente = codigoCliente;
    }

    /**
     * @return o dataInicial
     */
    public String getDataInicial() {
        return dataInicial;
    }

    /**
     * @param dataInicial o dataInicial a ser configurado
     */
    public void setDataInicial(String dataInicial) {
        this.dataInicial = dataInicial;
    }

    /**
     * @return o dataFinal
     */
    public String getDataFinal() {
        return dataFinal;
    }

    /**
     * @param dataFinal o dataFinal a ser configurado
     */
    public void setDataFinal(String dataFinal) {
        this.dataFinal = dataFinal;
    }

    /**
     * @return o historicoList
     */
    public List getHistoricoList() {
        return historicoList;
    }

    /**
     * @param historicoList o historicoList a ser configurado
     */
    public void setHistoricoList(List historicoList) {
        this.historicoList = historicoList;
    }

    /**
     * @return o historicoProdutoList
     */
    public List getHistoricoProdutoList() {
        return historicoProdutoList;
    }

    /**
     * @param historicoProdutoList o historicoProdutoList a ser configurado
     */
    public void setHistoricoProdutoList(List historicoProdutoList) {
        this.historicoProdutoList = historicoProdutoList;
    }

    /**
     * @return o method
     */
    public String getMethod() {
        return method;
    }

    /**
     * @param method o method a ser configurado
     */
    public void setMethod(String method) {
        this.method = method;
    }

ACTION

public ActionForward listar(ActionMapping mapping, ActionForm form, 
        HttpServletRequest request, HttpServletResponse response) throws Exception {
    ...
} 

1 answer

2

Guys, I managed to solve my problem with a simple change in the parameters of the Actionforward method. The problem was the method:

public Actionforward detail(Actionmapping Mapping, Actionform form, Httpactionrequest request, Actionresponse Response) throws Exception { }

I also tried with the: public Actionforward detail(Actionmapping Mapping, Actionform form, Httprequest request, Actionresponse Response) throws Exception { }

and it didn’t work....

Corrected with the

public Actionforward detail(Actionmapping Mapping, Actionform form, Actionrequest request, Actionresponse Response) throws Exception { }

Browser other questions tagged

You are not signed in. Login or sign up in order to post.