| |

VerySource

 Forgot password?
 Register
Search
View: 675|Reply: 3

How to customize method for String type

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-2-2 08:40:01
| Show all posts |Read mode
Is such that:
I use a form to pass parameters, so that I can display Chinese only after taking out
  String myname = request.getParameter ("myname");
  myname = new String (myname.getBytes ("ISO8859_1"), "utf-8");
Now I want to define a method for String data. Let's say togbk (String str)
 I can do this directly in the future
 String myname = togbk (request.getParameter ("myname"));
How do I write class files and where do I put them?
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-3-19 22:45:01
| Show all posts
Google / baidu
request setCharacterEncoding web.xml
Then you know how to directly get the correctly encoded request parameters
Reply

Use magic Report

0

Threads

63

Posts

42.00

Credits

Newbie

Rank: 1

Credits
42.00

 China

Post time: 2020-3-19 23:30:01
| Show all posts
Sorry for missing one of the most important keywords
filter request setCharacterEncoding web.xml
Reply

Use magic Report

0

Threads

18

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-3-20 11:45:01
| Show all posts
filter request setCharacterEncoding web.xml




filter request setCharacterEncoding web.xml
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list