Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6370599
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:57:04+00:00 2026-05-25T00:57:04+00:00

I have a web app with spring,jsp and jquery in a apache tomcat 6,

  • 0

I have a web app with spring,jsp and jquery in a apache tomcat 6, one jsp page has a form that send the data with a ajax call made whit jquery, to a Spring MultiActionController on my back end.

The problem is with the UTF-8 strings in the form inputs.

I already did the following things:

On my HTML:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<%@ page contentType="text/html; charset=utf-8" %>
<%@ page language="java" pageEncoding="utf-8"%>

<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<head> 
.
.

On the jquery ajax call:

$.ajaxSetup({ scriptCharset: "utf-8" ,contentType: "application/x-www-form-urlencoded; charset=UTF-8" });
    $.ajax(
        {
            type: "GET",
            url: "./saveData.action",
            contentType: "charset=utf-8",
            data: { name: $('#name').val(),...

On the tomcat server.xml:

<Connector connectionTimeout="20000" port="8080" URIEncoding="UTF-8" protocol="HTTP/1.1" redirectPort="8443"/>

On the MultiActionController

public ModelAndView saveData(HttpServletRequest request,HttpServletResponse response) 
    throws ServletException, IOException 
    {
        request.setCharacterEncoding("UTF-8");
        String name = request.getParameter("name");

So if in the name parameter I put something like this:

María

in the backend I get

María.

I already tried all the things that I read about, and I don’t know what is the error, thanks for any help 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T00:57:05+00:00Added an answer on May 25, 2026 at 12:57 am

    Everything looks fine until the point that you get the parameter in a variable. It’s just your backend which still needs to be configured to use UTF-8. For example, the System.out.println() or the logger where you’re sending the retrieved parameter to should also use UTF-8. Or the database where you’re storing the retrieved parameter should also use UTF-8. Or the JDBC driver which is interacting with that DB. Or the text file where you’re writing the data to. Etcetera.

    See also:

    • Unicode – How to get the characters right?

    Unrelated to your concrete problem, the line

    request.setCharacterEncoding("UTF-8");
    

    should be executed before Spring kicks in. It sets the POST request encoding and this will fail whenever Spring determines the request body before executing the action (note that this line has totally no effect on GET requests). Spring has a CharacterEncodingFilter which does exactly that. Register this in your web.xml:

    <filter>
        <filter-name>characterEncodingFilter</filter-name>
        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
        <init-param>
            <param-name>forceEncoding</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>
    
    <filter-mapping>
        <filter-name>characterEncodingFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a (non-web app) Spring application that throws a NoSuchBeanDefinitionException when running tests
I have what seems like a simple problem. I have a Spring web app,
I have a web app for commercial property management that needs spreadsheet-like functionality for
I have a web-app-database 3 tier server setup. Web requests data from app, and
I have a web app that is heavily loaded in javascript and css. First
I have a web app that only registered users can use, therefore I should
I have a web app consisting of some JSPs that were previously running on
I have a Java/Spring MVC/JSP/JSTL webapp. We have a designer that gave us some
I have a web app that is using Bayeux to handle Comet connections. I
I have working Hibernate/Spring web-app ( HibernateDaoSupport , getHibernateTemplate() , etc). For several tasks

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.