Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9174947
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:50:08+00:00 2026-06-17T16:50:08+00:00

I am using/learning Spring 3.1. I’m trying to pull Strings out of *.properties file.

  • 0

I am using/learning Spring 3.1. I’m trying to pull Strings out of *.properties file. Google around I couldn’t find a complete example. I managed to piece all of this together. It compiles and funs, but I don’t get any values. Any clues about what I am missing?

My messages.properties file called messages.properties
located in war/WEB-INF/classes

test = From Messages Properties File

My application context file called acme-servlet.xml

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:mvc="http://www.springframework.org/schema/mvc"
  xmlns:util="http://www.springframework.org/schema/util"
  xsi:schemaLocation="http://www.springframework.org/schema/mvc
        http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
        http://www.springframework.org/schema/beans     
        http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
        http://www.springframework.org/schema/context 
        http://www.springframework.org/schema/context/spring-context-3.1.xsd
        http://www.springframework.org/schema/util
        http://www.springframework.org/schema/util/spring-util-3.1.xsd">

  <context:component-scan base-package="gov.noaa.acme.controller" />

  <mvc:resources mapping = "/**" location = "/,file:/apps1/bea/user_projects/domains/SDB/common/"/>
  <mvc:annotation-driven/>

  <!-- define the properties file to use -->
  <util:properties id = "messages" location="classpath:/messages.properties" />

  <bean
    class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name = "prefix" value = "/jsp/"/>
    <property name = "suffix" value = ".jsp"/>
  </bean>

  <bean name="af" class="gov.noaa.acme.controller.security.AuthenticationFilter"/>

  <!-- Configure the multipart resolver -->
  <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
    <!-- one of the properties available; the maximum file size in bytes -->
    <property name="maxUploadSize" value="100000000"/>
  </bean>

</beans>

My controller class( simplified )

package com.acme.controller;

import java.security.Principal;
import javax.servlet.http.*;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.validation.*;
import org.springframework.ui.ModelMap;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.SessionAttributes;

import org.apache.log4j.Logger;

@Controller
public class LoginController {

    @Value("#{messages['messages.test']}") private String test;
    private static final Logger logger  = Logger.getLogger(LoginController.class);

    @RequestMapping({"/","home"})
    public String home(ModelMap model,HttpSession session,HttpServletRequest request) {

        model.put("test",test);
        return "login";
    }

}// end class LoginController

My log.jsp file:(simplified)

<%@ page language = "java" session = "true" import = "java.util.*, java.text.*" %>
<%@ taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix = "f" uri="http://www.springframework.org/tags/form"%>

test: ${test}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:50:11+00:00Added an answer on June 17, 2026 at 4:50 pm

    You should use :

    @Value("#{messages['test']}")
    

    Instead of :

    @Value("#{messages['messages.test']}")
    

    And if you only have one property file, you can also use :

    @Value("#{test}")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Learning Android I'm trying to find contacts using DISPLAY_NAME selector. I need to find
I just started using/learning Python and have some questions. I have a text file
I'm currently learning Python using Zelle's Introductory text, and I'm trying to recreate one
I'm trying to setup a new web-application for learning purposes using the newest technologies:
I'm learning File I/O using Java. Following are my codes from two different Java
I am learning to use Spring and gradle by downloading the spring source using
I am learning Java using the book Java: The Complete Reference. Currently I am
I was learning how to make simple form validation using this tutorial: http://www.raistudies.com/spring/spring-mvc/form-validation-spring-mvc-3-hibernate-validator-jsr-303/ The
I am trying to make a dynamic form using Spring forms. Basically, the form
I am learning Hibernate with Spring and am creating an application using the same

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.