I18n translation in JSP custom tag?

I don't do Spring, but in "plain" JSP you can just put the ResourceBundle instance in the session scope with help of a Filter or Servlet ResourceBundle bundle = ResourceBundle. GetBundle(basename, request.getLocale()); request.getSession(). SetAttribute("bundle", bundle) And treat it in JSP like any other bean in EL ${bundlemessageKey} It must be possible to have Spring to put that as a bean in the session scope.

I don't do Spring, but in "plain" JSP you can just put the ResourceBundle instance in the session scope with help of a Filter or Servlet ResourceBundle bundle = ResourceBundle. GetBundle(basename, request.getLocale()); request.getSession(). SetAttribute("bundle", bundle); And treat it in JSP like any other bean in EL.

${bundlemessageKey} It must be possible to have Spring to put that as a bean in the session scope.

Rather than attaching to each session, it's probably easier to attach this to each page as a model attribute. – at. Sep 15 '10 at 18:46 Oh sorry, I overlooked that part.

You can do that using MessageFormat#format(). And yes, you can of course also just put it in the request scope. Creating new one on every HTTP request is only a bit more expensive after all.

– BalusC Sep 15 '10 at 18:57 Ok I got it, thanks. – at. Sep 15 '10 at 22:43.

There is a utility in spring to access the web application context. Then you can look up a bean by its name or type. To get hold of your resource bundle, you could do something like: WebApplicationContext springContext = WebApplicationContextUtils.

GetWebApplicationContext(pageContext. GetServletContext()); messageResource = springContext. GetBean("messageResource").

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send