Solved

Property Bean Not displaying on JSP Page

Posted on 2013-11-15
2
1,305 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 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
diffSum example 4 50
jsp login check 12 42
Java basic valueOf question 1 29
jsp error 6 25
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
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 …

808 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