Three frames (SSH) About URL forwarding garbled problem (a solution to the simplest violence)

Source: Internet
Author: User

These two days in the integration of the three framework when the STRUTS2 URL forwarding garbled problem, engaged in a long time also on the Internet to check a lot of information, write a filter, changed the configuration, all useless. Can only use the simplest form of violence, manual conversion garbled. because the editor starts with the default encoding of Iso-8859-1, the iso-8859-1 is converted to Utf-8.

General garbled problem, first check whether the database encoding is corresponding, the general installation of the database when the default encoding, if not set to Utf-8, add Chinese may appear garbled---can only modify the configuration or reload the database (this is not the focus of Ben Boven). Check the database, and then verify that the page encoding is consistent, if not solve the garbled problem, try to add Chinese test in the action layer, if there is no problem, it is Strust2 forwarding time into garbled. The solution is violent and simple.

Cases:

On the action layer:

Public String Execute () throws Unsupportedencodingexception
{
Title U=new title ();
U.setname (New String (Name.getbytes ("iso-8859-1"), "Utf-8"));
U.settype (New String (Type.getbytes ("iso-8859-1"), "Utf-8"));
U.setcondi (New String (Condi.getbytes ("iso-8859-1"), "Utf-8"));
U.setintro (New String (Intro.getbytes ("iso-8859-1"), "Utf-8"));
U.setorigin (New String (Origin.getbytes ("iso-8859-1"), "Utf-8"));
SimpleDateFormat df=new SimpleDateFormat ("Yyyy-mm-dd");
U.setdate (Df.format (New Date ()));
U.setgname ("Miss Chen");
U.setidea ("The subject is grey");
s.settitle_id (U);
Tmanager.add (U);
Smanager.update (s);
Return "Success";
}

No need to think through the brain, do not understand the forwarding mechanism, easy to solve garbled,

Three frames (SSH) About URL forwarding garbled problem (a solution to the simplest violence)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.