Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > EJB
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
EJB Be sure to indicate the version you use.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the EJB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 14th, 2005, 08:32 AM
Registered User
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem editing property file in war, from web pag

hi all,
I have two requirements:
1. get all the keys and their values from a property file and
   display them on a web page
2. edit any of the value for a key, and that should be reflected back
on the page, after saving.

point 1. works fine.

for point2. when every i save the values i am unable to get the reflected values.

I am using a property file (application.properties) which has an entry in the struts-config.xml

can property files be edited and the reflection be seen ???
 Plz help if there is a solution for this
                                      Thanks in advance,

  #2 (permalink)  
Old December 26th, 2005, 11:14 PM
Registered User
Join Date: Nov 2004
Location: Bhubaneswar, Orissa, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to anirbanbasuz


the problem is very interesting. It seem from your mail that you are using struts. Right? The thing is: Say you restart your server or redeploy your struts application. Now on the first hit to the app, the application.properties file is being loaded and all values are kept in memory. thats why you are not able to see any changes. Try reloading the application.properties file.

Anirban Basu
  #3 (permalink)  
Old December 28th, 2005, 05:03 AM
Registered User
Join Date: Dec 2005
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

hi Anirban Basu,
    Thank u for the reply,,

i got a partial solution to the problem, i kept the property file out side the web-inf folder in application-server(jboss). now i am able to update the property file. But each time i hav to restart the server for doing this, i even cleard the cache which is used by resource bundle.
                    satya varma

  #4 (permalink)  
Old March 23rd, 2006, 09:30 PM
Registered User
Join Date: Mar 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Have you solved this problem yet? I have a fix for it. It was not particularly easy and requires adding two new files that extend PropertyMessageResources and PropertyMessagesResourceFactory that over ride the default methods. You can then add an entry to struts-config.xml to have Struts use your new class:

    <message-resources factory="com.elasticpath.web.struts.commons.MSProp ertyMessageResourcesFactory" parameter="resources.application" />

This is required because Struts stores all messages from application.properties and any localized application_xx_XX.properties files in a protected HashMap called messages within the PropertyMessageResources:

If you look in the Struts source code for PropertyMessageResources all the system messages live here:

     * The cache of messages we have accumulated over time, keyed by the
     * value calculated in <code>messageKey()</code>.
    protected HashMap messages = new HashMap();

There is a method called loadLocale in PropertyMessageResources that is responsible for loading messages when they are first requested. We created a new method called reloadLocale in our class which extends PropertyMessageResources in which you pass in a properties file containing the keys and values you want to update. It's too long to post here so if you want the code email me j u s t i n . t i l s o n AT e l a s t i c . p a t h . c o m


  #5 (permalink)  
Old March 23rd, 2006, 09:32 PM
Registered User
Join Date: Mar 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

I made a mistake in my emailaddy: j u s t i n . t i l s o n AT e l a s t i c p a t h . c o m



Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
trap Yes or No value from a message box on web pag sansircar ASP.NET 1.0 and 1.1 Professional 7 February 2nd, 2006 04:51 PM
WAR file gauravchhabra9111 Servlets 1 February 11th, 2005 08:13 AM
Downloading a image file from Oracle on to JSP Pag ashwinmittal Pro JSP 1 November 25th, 2004 09:37 AM
Dissapear mouse and use key to navigate on web pag karib JSP Basics 0 July 2nd, 2004 12:53 AM
Problem with creating Custom Property in Web Servi saitx .NET Web Services 1 October 8th, 2003 10:10 AM

All times are GMT -4. The time now is 05:47 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.