Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Property Bean Not displaying on JSP Page

Posted on 2013-11-15
2
Medium Priority
?
1,425 Views
Last Modified: 2013-11-21
Hi,

I've created a Bean in my servlet-context.xml file.  It references a properties file and I would like to call and display those properties on my JSP page.  I'm using Spring 3.1 MVC.

Here's my bean from Spring's servlet-context.xml:

    <beans:bean id="propertyConfigurer"   
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
            <beans:property name="location" value="/WEB-INF/app.properties" />
    </beans:bean> 

Open in new window


Here are the contents of my app.properties file in WEB-INF:

app.env=development
app.VersionNo=v9.0
app.VersionBuild=.1

Open in new window


Here are the attempts to access the values in the jsp:

<title>${VersionNo} ${app.VersionNo}</title>

Open in new window


Any help would be greatly appreciated.

blue
0
Comment
Question by:blue44
2 Comments
 
LVL 21

Accepted Solution

by:
Amitkumar Panchal earned 1500 total points
ID: 39654121
If you are using spring tags then try the following.

1. load spring tags in jsp
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

2. use spring taf to render the property
<title>${VersionNo} <spring:message code="app.VersionNo" /></title>
0
 

Author Closing Comment

by:blue44
ID: 39668199
It helped but I wish there was a way to do this without using the Spring tags.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question