Error 404 in spring

Asked

Viewed 118 times

1

Man

<form method="POST" action="/desif/titulo/salvar/">
                                    <div class="form-group has-info">
                                        <label for="codigo"
                                            class="col-xs-12 col-sm-3 control-label no-padding-right"><font
                                            style="color: red">*</font> Código:</label>
                                        <div class="col-xs-12 col-sm-5">
                                            <span class="block input-icon input-icon-right"> <input
                                                name="codigo" type="text" id="codigo" class="width-100"
                                                maxlength="3" value="${titulo.codigo}"
                                                style="text-transform: uppercase" /> <i
                                                class="ace-icon fa fa-info-circle"></i>
                                            </span>
                                        </div>
                                        <div class="help-block col-xs-12 col-sm-reset inline">
                                            Campo obrigatório ! <br>Aceita até 3 números !
                                        </div>
                                    </div>
                                    <div class="form-group has-info">
                                        <label for="descricao"
                                            class="col-xs-12 col-sm-3 control-label no-padding-right"><font
                                            style="color: red">*</font> Descrição:</label>
                                        <div class="col-xs-12 col-sm-5">
                                            <span class="block input-icon input-icon-right"> <textarea
                                                    class="width-100 limited" id="form-field-9"
                                                    maxlength="1000" style="text-transform: uppercase"
                                                    name="descricao" id="descricao">${titulo.descricao}</textarea>
                                                <i class="ace-icon fa fa-info-circle"></i>
                                            </span>
                                        </div>
                                        <div class="help-block col-xs-12 col-sm-reset inline">
                                            Campo obrigatório ! <br>Aceita até 1000 caracteres !
                                        </div>
                                    </div>
                                    <div class="space-24"></div>
                                    <div class="form-group has-info">
                                        <label for="vigenciaDe"
                                            class="col-xs-12 col-sm-3 control-label no-padding-right"><font
                                            style="color: red">*</font> Início da vigência:</label>
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-5">
                                                <div class="input-group">
                                                    <span class="input-group-addon"> <i
                                                        class="fa fa-calendar bigger-110 blue"></i>
                                                    </span> <input class="input-medium date-picker" name="vigenciaDe"
                                                        id="vigenciaDe" type="text"
                                                        value="${titulo.inicioVigenciaFormatado}"
                                                        data-date-format="dd/mm/yyyy" placeholder="dd/mm/yyyy" />
                                                    <i class="ace-icon fa fa-info-circle"></i>
                                                </div>
                                            </div>
                                            <div class="help-block col-xs-12 col-sm-reset inline">
                                                Campo obrigatório ! <br>Só aceita dd/mm/yyyy !
                                            </div>
                                        </div>
                                    </div>
                                    <div class="form-group has-info">
                                        <label for="vigenciaAte"
                                            class="col-xs-12 col-sm-3 control-label no-padding-right">
                                            Fim da vigência:</label>
                                        <div class="row">
                                            <div class="col-xs-12 col-sm-5">
                                                <div class="input-group">
                                                    <span class="input-group-addon"> <i
                                                        class="fa fa-calendar bigger-110 blue"></i>
                                                    </span> <input class="input-medium date-picker" name="vigenciaAte"
                                                        id="vigenciaAte" type="text"
                                                        value="${titulo.fimVigenciaFormatado}"
                                                        data-date-format="dd/mm/yyyy" placeholder="dd/mm/yyyy" />
                                                    <i class="ace-icon fa fa-info-circle"></i>
                                                </div>
                                            </div>
                                            <div class="help-block col-xs-12 col-sm-reset inline">
                                                Campo obrigatório ! <br>Só aceita dd/mm/yyyy !
                                            </div>
                                        </div>
                                    </div>
                                    <c:if test="${not empty param.e}">
                                        <div class="form-group has-error">
                                            <label for="inputError"
                                                class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">
                                                <i class="ace-icon fa fa-times-circle"></i> Campos com * são
                                                obrigatórios !
                                            </label>
                                        </div>
                                    </c:if>
                                    <c:if test="${not empty param.a}">
                                        <div class="form-group has-info">
                                            <div class="help-block col-xs-12 col-sm-reset inline">
                                                Registro alterado com sucesso.</div>
                                        </div>
                                    </c:if>
                                    <c:if test="${not empty param.i}">
                                        <div class="form-group has-info">
                                            <div class="help-block col-xs-12 col-sm-reset inline">
                                                Registro incluído com sucesso.</div>
                                        </div>
                                    </c:if>
                                    <div align="right">
                                        <div>
                                            <button class="btn btn-white btn-info btn-bold">
                                                <i class="ace-icon fa fa-floppy-o bigger-120 blue"></i>
                                                Salvar
                                            </button>
                                            <a href="<%=url%>" style="color: #00000"
                                                class="btn btn-white btn-default btn-round" value="Cancelar" />
                                            <i class="ace-icon fa fa-times red2"></i> Cancelar</a> <input
                                                id="id" name="id" type="hidden" value="${titulo.id}" />
                                        </div>
                                    </div>
                                    </form>

Man

package br.com.netsoft.desif.controller.desif.federal;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import br.com.netsoft.desif.model.desif.federal.TituloEntity;
import br.com.netsoft.desif.repository.desif.federal.TituloRepository;

/**
 * Controller do títulos
 */
@Controller
@RequestMapping("titulo")
public class TituloController implements Serializable {

    private static final long serialVersionUID = 5517013742245137107L;

    @Autowired
    private TituloRepository repositoryTitulo;

    /**
     * Lista todos os títulos
     */
    @RequestMapping(method = RequestMethod.GET)
    public String index(Model model) {
        List<TituloEntity> listaTitulos = repositoryTitulo.listarTodosTitulos();
        model.addAttribute("listaTitulos", listaTitulos);
        return "deisf/federal/titulo/titulo_index";
    }

    /**
     * Novo título
     */
    @RequestMapping("novoTitulo")
    @Transactional
    public String novoEventoContabil() {
        return "deisf/federal/titulo/titulo_cadastrar_alterar";
    }

    /**
     * Editar título
     */
    @RequestMapping("editarTitulo")
    @Transactional
    public String editarTitulo(Long id, Model model) {
        model.addAttribute("titulo", repositoryTitulo.buscaPorId(id));
        return "deisf/federal/titulo/titulo_cadastrar_alterar";
    }

    /**
     * Incluir ou alterar um título
     */
    @RequestMapping(value = "/salvar/", method = RequestMethod.POST)
    @Transactional
    public String cadastrar(ModelMap map, TituloEntity titulo) {
        // if (titulo.getDescricao() == null || titulo.getDescricao().isEmpty())
        // {
        // model.addAttribute("e", "e");
        // return "redirect:novoTitulo";
        // }
        // String pagina = "";
        // if (titulo.getId() == null) {
        // pagina = "redirect:novoTitulo/?i=ok";
        // } else {
        // pagina = "redirect:editarEventoContabil?id=" + titulo.getId() +
        // "&a=ok";
        // }
        // repositoryTitulo.salvar(titulo);
        return "";
    }

}

When the system calls the

@Requestmapping(value = "/save/", method = Requestmethod.POST)

, gives page 404, only this, in this controller. What can be ?

In the eclipse debug shows:

DEBUG: org.springframework.web.servlet.Dispatcherservlet - Dispatcherservlet with name 'appServlet' Processing POST request for [/desif/eventContabel/save] DEBUG: org.springframework.web.servlet.mvc.method.Annotation.Requestmappinghandlermapping - Looking up Handler method for path /eventContabel/save DEBUG: org.springframework.web.servlet.mvc.method.Annotation.Requestmappinghandlermapping - Did not find Handler method for [/eventoContabel/save] WARN : org.springframework.web.servlet.Pagenotfound - No Mapping found for HTTP request with URI [/desif/eventContabel/save] in Dispatcherservlet with name 'appServlet' DEBUG: org.springframework.web.servlet.Dispatcherservlet - Successfully completed request

No answers

Browser other questions tagged

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