简体   繁体   中英

How to write .properties file from jsp

Hi i new to java i stuck here please help me... my problem is "I wrote a class to write the .properties file it is working fine when i run through normal application.But the problem is when i am using this in jsp means i have create object to this class and used it in my jsp but Iam unble to modify/write the .properties file and Iam not getting any errors".

what is the problem please explain and give if any solution to implement/write .properties file from jsp.

Regards, Venkatesh Gurram.

There is no specific reason that a JSP cannot write a properties file. If it is not working and there are no apparent errors, then I suspect:

  • the properties file is really being written, but not in the directory you are expecting it to be written,
  • you have configured your logging to suppress error messages, or
  • you are looking for errors in the wrong place.

IMO, the first is the most likely, especially if you are providing a relative pathname for the properties file. (If you instantiate a FileOutputStream using a relative pathname, it will be resolved relative to the web server process's "current directory" ... which may not be where you think it is.)

How did you define where you write your file ? Absolute or relative path ?

May be when you test your class you can write but when you test your jsp the location use the server location ?

Display the path in your jsp to check where it writes.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM