java - Spring MVC - Charset breaking when I submit my form -


solution: i've changed server tomcat jetty , charset normal

i'm having trouble enconding on application. everytime save database encoding breaks, reading ok (i tested changing manually on db).

as ralph asked i've checked if charset broke before save on database, , it's. i'm changing question reflect better problem.

i'm using spring mvc, hibernate , mysql. i've configurated spring use utf-8 in configuration class:

public class servletspringmvc extends     abstractannotationconfigdispatcherservletinitializer {     @override     protected class<?>[] getrootconfigclasses() {         return new class<?>[] { appwebconfiguration.class, jpaconfiguration.class, securityconfiguration.class};     }      @override     protected class<?>[] getservletconfigclasses() {         return new class<?>[] {};     }      @override     protected string[] getservletmappings() {         return new string[] {"/"};     }      @override     protected filter[] getservletfilters() {         characterencodingfilter encodingfilter = new characterencodingfilter();         encodingfilter.setencoding("utf-8");         encodingfilter.setforceencoding(true);         return new filter[] {encodingfilter};     }      @override     protected void customizeregistration(servletregistration.dynamic registration) {         registration.setmultipartconfig(new multipartconfigelement(""));     }       @override     public void onstartup(servletcontext servletcontext) throws servletexception             {         super.onstartup(servletcontext);         servletcontext.addlistener(requestcontextlistener.class);         servletcontext.setinitparameter("spring.profiles.active", "dev");     }  } 

my jsp is:

<%@ page contenttype="text/html;charset=utf-8" language="java" pageencoding="utf-8" %> <%@ taglib prefix="tags" tagdir="/web-inf/tags" %> <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %> <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  <tags:template title="jobs"> <jsp:attribute name="bodyarea">  <div class="container">     <c:if test="${not empty jobid}">         <c:url var="urlaction" value="${spring:mvcurl('jc#updatejob').arg(0,jobid).build()}"/>     </c:if>     <c:if test="${empty jobid}">         <c:url var="urlaction" value="${spring:mvcurl('jc#addjob').build()}"/>     </c:if>     <form:form action="${urlaction}" method="post" modelattribute="jobdto" id="form" acceptcharset="utf-8">         <input type="hidden" name="board" value="${boardid}">          <div class="form-group">             <label> <spring:message code="job.form.client"/> </label>             <form:input path="client" cssclass="form-control"/>             <form:errors path="client"/>         </div>          <div class="form-group">             <label> <spring:message code="job.form.priority"/> </label>             <form:select path="priority" cssclass="form-control">                 <form:option value="" label=""/>                 <form:options items="${priorities}"/>             </form:select>             <form:errors path="priority"/>         </div>          <div class="form-group">             <label> <spring:message code="job.form.status"/> </label>             <form:select path="status" cssclass="form-control">                 <form:option value="" label=""/>                 <form:options items="${statuses}"/>             </form:select>             <form:errors path="status"/>         </div>          <div class="form-group">             <label> <spring:message code="job.form.responsible"/> </label>             <form:select path="responsible" cssclass="form-control">                 <form:option value="" label=""/>                 <form:options items="${boardhelper.getboardusers(boardid)}"/>             </form:select>             <form:errors path="responsible"/>         </div>          <div class="form-group">             <label> <spring:message code="job.form.description"/> </label>             <form:textarea path="description" cssclass="form-control" rows="5"/>             <form:errors path="description"/>         </div>     </form:form>     <div class="container">         <div class="row">             <div class="col-lg-1">                 <button type="submit" class="btn btn-success" form="form">                     <span class="glyphicon glyphicon-floppy-disk"></span>                     <spring:message code="save"/>                 </button>             </div>             <c:if test="${not empty jobid}">                 <div class="col-lg-1">                     <form action="${spring:mvcurl('jc#deletejob').arg(0,jobid).build()}" method="post">                         <button type="submit" class="btn btn-danger">                             <input type="hidden" name="${_csrf.parametername}" value="${_csrf.token}"/>                             <span class="glyphicon glyphicon-trash"></span>                             <spring:message code="delete"/>                         </button>                     </form>                 </div>             </c:if>         </div>     </div> </div>  </jsp:attribute> </tags:template> 


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -