First, the problem description
Problem:
When using <pg:param name= "key"/> Tag to pass Chinese parameters, there will be garbled characters.
Reason:
Because it is the default to use gb2312 to encode the added parameters, if your filter, JSP pages are used gb2312 There is no problem, if you are using Utf-8 to encode , Then the Chinese parameter passing the process will be garbled, resulting in unresolved.
Second, problem solving methods
There are many solutions on the web, and it is a good idea to re-modify the compiled source code:
In the AddParam of Pagertag under Com\jsptags\navigation\pager (string name, String value), It originally used the urlencoding.encode (value) method to encode the passed parameters, modified to become urlencoding.encode (value, "UTF-8"), Replace this class file with the original jar package and repackage it into the project.
1. First Extract the files from the Pager-src.jar .
You can see there's two files in there.
2. Create an empty Javaproject project in Eclipse , name pager-taglib,
Copy the two files you extracted above
3. because some of the classes in javax.servlet.* are used in the above class
So to import the Javaee.jar package
If you are in myeclipse , import the javaee5 jar package directly, or import the entire Java EE 5Libraries
4. then modify
In the AddParam of Pagertag under Com\jsptags\navigation\pager (string name, String value), It originally used the urlencoding.encode (value) method to encode the passed parameters, modifying it to become Urlencoding.encode (value, "UTF-8"). Of course urlencoding.encode (name) can also be modified to Urlencoding.encode (name, "UTF-8") and finally use Try/catch for exception snapping
5. Export the jar package
Export--->java---->java jarfile- lead jar package
6. re-import into the Web project
Pagination Technical Framework (PAGER-TAGLIB) learning three (Chinese garbled problem when passing parameters in Pager-taglib)