Chinese parameter garbled characters passed between actions in struts2
Solution 1 (verified ):
Both actions define the get and set methods of the parameter attributes to be passed. They must be the same!
Define in struts. xml:
<Result name = "input" type = "Redirect">
<Param name = "location">/Homepage. IC? Loginerror =$ {loginerro R} </param>
<Param name = "encode"> true </param>
</Result>
Solution 2 ):
Use
Username. setname (uriutil. encodequery (username. getn ame ()))
Note: post form submission is normal, get method to submit Chinese garbled characters, add "uriencoding = UTF-8" to the connector tag of Tomcat configuration file server. xml ".
You can use Param:
<Action name = "brosales" class = "salesaction" method = "brosales">
<Result>/sales/salesbro. jsp </result>
<Result name = "input" type = "redirectaction">
<Param name = "actionname"> listsales. DO </param>
<Param name = "namespace">/sales </param>
<Param name = "sogroupid" >$ {sogroupid} </param>
<Param name = "soname" >$ {soname} </param>
</Result>
</Action>