Solved

Property Bean Not displaying on JSP Page

Posted on 2013-11-15
2
1,322 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 21

Accepted Solution

by:
Amitkumar Panchal earned 500 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

Forrester Webinar: xMatters Delivers 261% ROI

Guest speaker Dean Davison, Forrester Principal Consultant, explains how a Fortune 500 communication company using xMatters found these results: Achieved a 261% ROI, Experienced $753,280 in net present value benefits over 3 years and Reduced MTTR by 91% for tier 1 incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 64
How to execute a Python program and gather return output in Java 2 49
add projects t working set in maven 2 37
Html split(text) 2 26
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

740 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