How to use property from property file specified in PropertyPlaceholderConfigurer in JSP?

PropertyPlaceholderConfigurer can only parse placeholders in Spring configuration (XML or annotations). Is very common in Spring applications use a Properties bean. You can access it from your view this way (assuming you are using InternalResourceViewResolver ).

PropertyPlaceholderConfigurer can only parse placeholders in Spring configuration (XML or annotations). Is very common in Spring applications use a Properties bean. You can access it from your view this way (assuming you are using InternalResourceViewResolver): classpath:config.

Properties properties Then, in your JSP, you can use ${properties. MyProperty}.

Really good! But the first bean in declaration is of PropertiesFactoryBean type, not of ProperyPlaceholderConfigurer. Should this mean that in order to have replacement of property placeholders in xml I am to duplicate declaration of application properties in PropertyPlaceholderConfigurerBean?

– glaz666 Oct 15 '10 at 8:10 @glaz666: I forgot to say that PropertyPlaceholderConfigurer is not appropiate for this. I edited my answer a little. – Sinuhe Oct 15 '10 at 9:28 I have passed this "properties" bean to PlaceHolderConfigurer and it seems to work, but still I can't make it work in JSP files because when I try to access ${properties} it is even not trying to call getAttribute from ContextExposingHttpServletRequest where bean exposing happens – glaz666 Oct 15 '10 at 13:36 @glaz666: Strange behaviour... Which version of Spring MVC are you using?

${...} works ok for other objects (such your controller results)? – Sinuhe Oct 15 '10 at 13:59 Ok, I have figured out what is going on. I am using sitemesh and when I am trying to refer to a bean in spring context on decorator page it is unavailable due to no spring's request wrapper is applied at that time.

I have created another question on how to do that. Stackoverflow. Com/questions/3952755/….

Thanks for help here! – glaz666 Oct 17 '10 at 10:04.

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