user2120239
user2120239

Reputation: 135

extending FilterDispatcher struts2

In my project code I can see FilterDispatcher being extended to set the default encoding as "UTF-8". My question is there any other better way we can do the same or this is the best way.

PS: The initial development was done in a country on Non-English windows PCs.

Upvotes: 1

Views: 256

Answers (1)

Aleksandr M
Aleksandr M

Reputation: 24396

Actually there is struts.i18n.encoding constant which sets default locale and encoding scheme. You can set it in struts.properties file:

struts.i18n.encoding=UTF-8

or in struts.xml file:

<constant name="struts.i18n.encoding" value="UTF-8" />

BTW: struts.i18n.encoding should be set to UTF-8 by default in Struts2 anyway.

BTW no.2: FilterDispatcher is deprecated since Struts 2.1.3. So if you using version higher than that use StrutsPrepareAndExecuteFilter instead.

Upvotes: 2

Related Questions