Where to put a properties file in Struts 2?

后端 未结 4 382
春和景丽
春和景丽 2020-12-16 04:58

I have a property file placed in the root of the web project in Java. I am using Struts 2. My code is unable to read properties file. Where should I keep my properties file?

4条回答
  •  孤城傲影
    2020-12-16 05:38

    Ideally, you can save properties files in: /src/com/cft/web/bundle/. like, /src/com/cft/web/bundle/LabelResources.properties OR /src/com/cft/web/bundle/Applicationresources.properties.

    in fact its up to you to give whatever the path you like.

    Just remember to add the correct complete path in web.xml/struts-config.xml

    for ex=g. 1. in web.xml :

    		Application Resources
    		ApplicationResources
    		com.cft.web.bundle.ApplicationResources
    		java.lang.String

    1. In Struts-config.xml

提交回复
热议问题