Since, you are asking this I hope you are using spring MVC only.
Well I am not writing a full tutorial here, but few simple steps.
Just google along this and it'll get done.
1. In dispatcher
servlet xml you need to specify locale resolver. It can be either session base locale resolver or cookie based locale resolver (it is spring api bean). Give base path as message.
2. Make message.properties file say for persian message_pe.properties
3. In jsps import taglib and use <spring:message tags
4. At the point where so may need to switch locale (say hit of button), get the locale resolver bean and set locale as "pe" or "en" etc.