Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to access WAR properties file in JSTL?

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using Spring 3.1.1.RELEASE on JBoss 7. I have a WAR file with a properties file, "application.properties" located in the WEB-INF/classes directory. Is it possible to access properties from this file through JSTL? I have tried



but calling



outputs "???default.country.selected???". Thanks for any guidance, - Dave
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure application.properties is in the root of the classpath? Have you cracked open the war and verified? Also verify it is spelled correctly.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "root of your classpath", do you mean at the root of my WEB-INF/classes directory? If so, yes, I've verified that the file is appearing there and the property I mentioned exists. Am I to assume from your questions that everything is set up correctly?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah, I discovered I didn't have things setup properly. Changing



to



fixed my problem (I'm able to access properties now). -
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah I missed that at first glance that you were not using setBundle. With the old way you could have done this:



 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic