4
respostas

requestmapping não esta pegando o redirecionamento direito =(

requestmapping não esta pegando o redirecionamento direito =( deu certo, adicionei dependencias erradas

4 respostas
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Dados do Sistema</title>
</head>
<body>
    <form action="/Squadra/dadosDoSistema" method="post">
        <div>
            <label>Descrição*: </label>
            <input type="text" name="descricao" required/><br/>
        </div>
        <div>
            <label>Sigla*: </label>
            <input type="text" name="sigla" required/><br/>
        </div>
        <div>
            <label>E-mail de atendimento do sistema: </label>
            <input type="email" name="email"/><br/>
        </div>
        <div>
            <label>URL: </label>
            <input type="text" name="url"/><br/>
        </div>
        <button type="submit">Salvar</button>
    </form>
</body>
</html>
package org.Squadra;

import org.Squadra.dao.SistemaDAO;
import org.Squadra.models.Sistema;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class DadosDoSistemaController {

    @Autowired
    private SistemaDAO dao;

    @RequestMapping(value="/dadosDoSistema/form", method=RequestMethod.POST)
    public String form() {
        return "dadosDoSistema/form";
    }

    @RequestMapping(value="/dadosDoSistema", method=RequestMethod.POST)
    public String okay(String descricao, String email, String sigla, String url) {
        //Sistema dados
        System.out.println(descricao);

        //dao.incluir(dados);
        return "dadosDoSistema/okay";
    }


}
package org.Squadra;

import org.Squadra.dao.SistemaDAO;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

@EnableWebMvc
@ComponentScan(basePackageClasses= {SistemaController.class, SistemaDAO.class})
public class AppWebConfiguration extends WebMvcConfigurerAdapter {

    @Bean
    public InternalResourceViewResolver internalResourceViewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        return resolver;


    }
}

Bom dia Gabrielle, DadosDoSistemaController está no mesmo pacote de SistemaController???