Discussions

Web tier: servlets, JSP, Web frameworks: Struts ApplicationResources.properties

  1. Struts ApplicationResources.properties (4 messages)

    Hi,

    I am creating a struts web app. ApplicationResources.properties is supposed to hold some application specific constants for the web app. How and where do parse (if that's right word) ApplicationResources.properties file in order to extract those constants in put them in application scope.

    Or more basic question: how do I use ApplicationResources.properties file to store application constants/properties and how can I make use of it.

    Thanks,
    P.I.
  2. Struts ApplicationResources.properties[ Go to top ]

    Hi!

    You donot need to do anything yourself. Just mention it in your strut-config.xml as:
    <message-resources parameter="ApplicationResources"/>

    Now whenever in your JSP, you like to use it just use bean:message and give the key against which you have stored your string or message that you have stored in the properties file
  3. Struts ApplicationResources.properties[ Go to top ]

    How can I use JSP if I want to extract these variables to form Application configuration - so that java beans and DAOs can use them. should my first JSP (may be loging.jsp) do the extraction and form the app. configuration?

    Thanks,
    P.I.
  4. Struts ApplicationResources.properties[ Go to top ]

    Hi P.I.-

    Do you mean that you want to use the configuration information outside of the control layer? It seems like one option would be to pass them directly to the model layer in your action classes, where the information should be available in the ServletContext.

    In terms of where they should be initialized, it seems like the init() method of your ActionServlet would be an appropriate place.

    HTH

    P
  5. Hi!

    You donot need to do anything yourself. Just mention it in your strut-config.xml as:


    Now whenever in your JSP, you like to use it just use bean:message and give the key against which you have stored your string or message that you have stored in the properties file
    hello sir, i went through your post, but as u said, i am not getting the details using the applicationresources.properties file. i am using eclipse 3.1 with myeclipse, the data is being shown in the preview but not in the browser when i am running my project awaiting your reply. sreejith