aspose file tools
The moose likes Java in General and the fly likes integer from properties file Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "integer from properties file" Watch "integer from properties file" New topic
Author

integer from properties file

nagesh siddu
Greenhorn

Joined: Nov 09, 2005
Posts: 6
hi all,
i needed to read two integers from property file into a JSP. has any one got an example for this?
regards,
Nagesh
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3652

Check out java.util.Properties.load(). Its a general method to read properties files from an InputStream and load them into a Properties object set.

Depending on where the data is coming from (the user, server, specific file location, etc) your code to read the file as and send it to a stream will vary.


My Blog: Down Home Country Coding with Scott Selikoff
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by nagesh siddu:
i needed to read two integers from property file into a JSP. has any one got an example for this?


You get those integer values as string then after getting, you have to covert those into Integer/int, as per your requirement, in your code.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56166
    
  13

Not really JSP-specific, so moved.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Adam Richards
Ranch Hand

Joined: Nov 03, 2005
Posts: 133
In a universe far, far away, I approached this by extending the Properties class & addding getters & putters for specific datatypes. For example:
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19216

What you can also do is the following:


SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: integer from properties file
 
Similar Threads
mysqlDriver.jar inside a JAR file
from class file to java file
hashtable to file
Array dimension missing
Is there an easy way