Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

erro do message

fiz como no curso, todos os arquivos e ja repassei mas não encontro o porque ta dando esse erro:

No message found under code 'field.required' for locale 'pt_BR'

ja coloquei o getAllErrors e mostra isso

[Field error in object 'usuario' on field 'email': rejected value []; codes [field.required.usuario.email,field.required.email,field.required.java.lang.String,field.required]; arguments []; default message [null], Field error in object 'usuario' on field 'nome': rejected value []; codes [field.required.usuario.nome,field.required.nome,field.required.java.lang.String,field.required]; arguments []; default message [null], Field error in object 'usuario' on field 'senha': rejected value []; codes [field.required.usuario.senha,field.required.senha,field.required.java.lang.String,field.required]; arguments []; default message [null]]

meu form:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="s"%>
<%@ taglib uri="http://www.springframework.org/security/tags"
    prefix="security"%>

<!DOCTYPE>
<html>
<head>
<meta charset=UTF-8>
<title>Cadastro</title>

<c:url value="/" var="contextPath" />

<script type="text/javascript"
    src="${contextPath}resources/js/jquerymin.js"></script>
<script type="text/javascript"
    src="${contextPath}resources/js/controle.js"></script>

<script type="text/javascript"
    src="${contextPath}resources/js/bootstrap.min.js"></script>

<link href="${contextPath}resources/css/bootstrap.min.css"
    rel="stylesheet" type="text/css" media="all" />

<link href="${contextPath}resources/css/bootstrap.min.css"
    rel="stylesheet" type="text/css" media="all" />

<link href="${contextPath}resources/images/logo.png" rel="icon"
    type="image/icon" media="all" />
<link href="${contextPath}resources/css/bootstrap-theme.min.css"
    rel="stylesheet" type="text/css" media="all" />



</style>

</head>
<body>



    <nav class="navbar navbar-inverse fixed-top">

        <div class="navbar-header">

            <a class="navbar-brand"><img
                src="${contextPath}resources/images/logo.png" width="35px"
                height="35px"></a>

        </div>

        <div class="collapse navbar-collapse">
            <ul class="nav navbar-nav navbar-right">
                <li><a href='<c:url value="/"/>'>Home</a></li>
                <li><security:authorize access="isAuthenticated()">
                        <a href='<c:url value="/departamento/lista"/>'>Lista de
                            Usuarios</a>
                    </security:authorize></li>
                <li><a href='<c:url value="/usuario/bemVindo"/>'>Sobre</a></li>

                <li><a href='<c:url value="/login"/>'><span
                        class="glyphicon glyphicon-log-in"></span> Entrar</a></li>

                <li><security:authorize access="isAuthenticated()">
                        <form action="${contextPath}logout">
                            <input type="submit" value="logout">
                        </form>
                    </security:authorize></li>

            </ul>
        </div>
    </nav>

    <div class="container-fluid text-center">
        <div class="row content">
            <div class="col-sm-2 sidenav">
                <div class="list-group">lateral esquerdo</div>
            </div>

            <div class="col-sm-8 text-left">
                <h1>Cadastro</h1>


                <div id="cadastrado" class="alert alert-success">
                    <strong>${nao}</strong>
                </div>

                <div id="naocadastrado" class="alert alert-danger">
                    <strong>${sim}</strong>
                </div>

                <form:form action="${ s:mvcUrl('UC#gravar').build() }" method="post"
                    commandName="usuario">
                    <div class="form-group">
                        <form:errors path="email"></form:errors>
                        <label>Email:</label> <input name="email" id="email" type="email"
                            class="form-control" placeholder="Digite o e-mail" />

                    </div>
                    <div class="form-group">
                        <form:errors path="senha"></form:errors>
                        <label>Senha:</label> <input name="senha" type="password"
                            class="form-control" placeholder="Digite a senha">

                    </div>
                    <!--                     <div class="form-group"> -->
                    <!--                         <label>Role:</label> <input name="roles.nome" type="text" -->
                    <!--                             class="form-control" placeholder="Digite a role"> -->
                    <!--                     </div> -->
                    <div class="form-group">
                        <form:errors path="nome"></form:errors>
                        <label>Nome:</label> <input name="nome" type="text"
                            class="form-control" placeholder="Digite o nome">

                    </div>

                    <div>
                        <label>Perfil:</label>
                    </div>
                    <button type="submit" class="btn btn-primary">Enviar</button>

                </form:form>
            </div>
            <div class="col-sm-2 sidenav">lateral direito</div>
        </div>
    </div>
</body>
</html>

appweb

package br.com.preconizado.conf;

import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;

import br.com.preconizado.controllers.HomeController;
import br.com.preconizado.daos.AreasAdminDAO;
import br.com.preconizado.daos.CategoriaDAO;
import br.com.preconizado.daos.DepartamentoDAO;
import br.com.preconizado.daos.FamiliaDAO;
import br.com.preconizado.daos.SetorDAO;
import br.com.preconizado.daos.SubFamiliaDAO;
import br.com.preconizado.daos.UsuarioDAO;
import br.com.preconizado.models.AreasAdmin;

@EnableWebMvc
@ComponentScan(basePackageClasses = { HomeController.class, DepartamentoDAO.class, SetorDAO.class, CategoriaDAO.class,
        FamiliaDAO.class, SubFamiliaDAO.class, UsuarioDAO.class, AreasAdminDAO.class, AreasAdmin.class, })
// @EnableCaching
public class AppWebConfiguration extends WebMvcConfigurerAdapter {

    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    @Bean
    public InternalResourceViewResolver internalResourceViewResolver() {

        InternalResourceViewResolver resolver = new InternalResourceViewResolver();
        resolver.setPrefix("/WEB-INF/views/");
        resolver.setSuffix(".jsp");
        return resolver;
    }

    @Override
    public void configureDefaultServletHandling(DefaultServletHandlerConfigurer configurer) {
        configurer.enable();
    }

    // @Bean
    // public CacheManager cacheManager() {
    // return new ConcurrentMapCacheManager();
    // }

    @Bean
    public MessageSource messageSource() {
        ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
        messageSource.setBasename("/WEB-INF/messages");
        messageSource.setDefaultEncoding("UTF-8");
        messageSource.setCacheSeconds(1);
        return messageSource;
    }

}

message.properties

field.required = Campo é obrigatorio
field.required.usuario.email = Campo email é obrigatorio
field.required.usuario.nome = Campo nome é obrigatorio
field.required.usuario.password = Campo senha é obrigatorio
typeMismatch = Tipo de dado foi invalido

estou usando o security sera que ele barra isso?se sim onde habilito?

1 resposta
solução!

encontrei o erro estava no meu app o nome do arquivo de msg tava errado :)