java - How can I obtain the message resources object in a servlet? -


I am developing a project with Straits and I was wondering if it is possible to get message resources in message server , Which is included in the same project.

There is no possibility of receiving that object with the getResources (HTTPServletRequest) because the servlet does not extend the action class.

OK, what's the way to do this?

In the end I found how to do this. If anyone is stuck on this issue, then the solution is to: Use the java.util.ResourceBundle class in your servlet.

You will have to pass the resource bundle with the name of the property class, the location you want to use, as you can see below:

  ResourceBundle RB = new Resource Bundle ("com.foo.package.theClass", myLocale); // and then get the message from the RB object rb.getMessage ("myPropertiesKey");  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -