Results 1 to 3 of 3

Thread: Load a properties file in application context

  1. #1
    Join Date
    Aug 2012
    Posts
    1

    Question Load a properties file in application context

    Hi,

    I am pretty new to Spring MVC. my problem goes as below.
    i am using conventional directory strucure i.e. separate folder for properties,css,js under WEB-INF.
    i have my servletname-servlet.xml and applicationContext.xml under WEB-INF

    I have a home page where i show several links, which are stored in a properties file.

    i can load a property file from the *-servlet.xml, pull a particular prop[which is a link]in my controller using EL and @Value annotation, store it in session and then display on my home page...works fine...but this involves a lot of tasks like pulling tht particular link from the servlet-context and storing in the session.

    Is there a way that i load the property file from application context rather than servlet context and display the same directly on a JSP??

    i hope i am clear enough...i don't want to meddle with session or anything...just configure my property file in say applicationContext and use EL to display a property on the JSP....

    thanks in advance for the help.

    PS -- even properties loaded in *-servlet.xml can't be displayed directly on a JSP...is there a way to do that either ??
    Last edited by pan3688; Sep 4th, 2012 at 02:17 AM.

  2. #2

    Default

    Is there a way that i load the property file from application context rather than servlet context
    You can define a PropertyPlaceholderConfigurer bean and load your properties in your root application context, these properties will be shared across all your servlet context.

  3. #3
    Join Date
    Sep 2012
    Posts
    1

    Default

    Senator Catharine Young is up for re-election in November (as is the entire New York legislature), so let’s take a quick look and see where her campaign money is coming from.

    It shouldn’t come as any surprise that the real estate industry is leading the pack by a hefty margin. Landlords love Cathy Young.
    Senator Catharine Young

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •