1

I am using jquery i18n plugin to internationalize the messages placed in jquery/js. i have below project structure.

enter image description here

I have some.js file in js folder and inside some.js file i have to refer a properties file which is located in src/main/resources folder. can i do as below?

jQuery.i18n.properties({
    name:'Messages', 
    path:'resources/',  //as i have properties file in src/main/resources am referring.
    mode:'both'

});
user755806
  • 6,565
  • 27
  • 106
  • 153

1 Answers1

0

Maybe. You need to understand that Java source paths and Web paths are unrelated unless you write some code to connect the two.

My suggestion for requirements like this is to put all resources into a certain package (which doesn't contain anything else, especially no classes in src/main/java).

Also note that src/main/resources will be gone when you deploy. After deployment, all resources will be available from the Java Classpath and relative to the classpath root. So if the source path is src/main/resources/foo/, it will be foo/ at runtime.

If you use Spring on the server side, you can use mvc:resources.

This question has a solution without Spring: Servlet for serving static content

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820