How to directly display a property value defined via PropertySourcesPlaceholderConfigurer in a jsp (Spring framework)? -
i have following configuration in spring application context.
<bean class="org.springframework.context.support.propertysourcesplaceholderconfigurer"> <property name="props"> <list> <value>file://${user.home}/myconfig.properties</value> </list> </property> </bean> let's want display value (e.g : app.url.secret) defined property in myconfig.properties file, directly in jsp. how can achieve ?
thanks in advance help
you have model in way:
one approach use propertyholder way:
@component public class propertyholder { @value("${myprop}") private string myproperty; //getters , setters.. } in controller:
@controller public class mycontroller { @autowired private propertyholder propertyholder; @modelattribute public void setmodelattributes(model model) { model.put("myprops", propertyholder); } ....rest of controller.. } then have access myprops in jsp - myprops.myproperty
Comments
Post a Comment