Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to develop and solve the problem of Struts garbled code under Eclipse tool

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

It is believed that many inexperienced people are at a loss about how to develop and solve the problem of Struts garbled under Eclipse tools. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

There are three main problems with Struts garbled:

1If value is in Chinese in the resource file in struts struts, struts garbled is displayed.

Solution: use the eclipse plug-in Properties Editor

2. Enter Chinese to display garbled codes in the text field.

Solution: use the servlet filter filter

In the simplest way, you can use the filters.SetCharacterEncodingFilter under tomcat to add tomcat to your web.xml configuration and servlet_examples the corresponding configuration (experts can configure it on their own!)

My configuration is as follows:

SetCharacterEncodingfilters.SetCharacterEncodingFilterencodingGBKSetCharacterEncoding*.do

3. Read out garbled codes from some databases.

Solution: re-encode the parts you want to display in Chinese

For example:

While (rs.next ()) {string col1=rs.getString (1); string col2=rs.getString (2); string col3=rs.getString (3); float col4=rs.getFloat (4); col1=new string (col1.getBytes ("iso-8859-1"), "GB2312"); col2=new string (col2.getBytes ("iso-8859-1"), "GB2312"); col3=new string (col3.getBytes ("iso-8859-1"), "GB2312"); -}

So far, the problem of Struts garbled has been solved.

After reading the above, have you mastered how to develop and solve the problem of Struts garbled under the Eclipse tool? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report