Meaningless Drivel is fun!*
The moose likes Beginning Java and the fly likes Droplet Properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Droplet Properties" Watch "Droplet Properties" New topic
Author

Droplet Properties

keith tyson
Greenhorn

Joined: Sep 28, 2001
Posts: 7
I am writing a droplet to be used from within a jhtml page. How do I read a property from the droplet.properties file into an array.
e.g. In the droplet.properties file I have a property:-
catId=10,12,33,45,50
In the droplet.java how do I set these up in a String array when the droplet is instanciated.
I think this is done with the get'er and set'er of this property, but ....
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Keith you question raised my curiosity. I did a quick search on Google. Are Droplets a Mac specific thing ?.
keith tyson
Greenhorn

Joined: Sep 28, 2001
Posts: 7
Sorry, I didn't explain very well.
Droplets are used in jhtml to call in other jhtml source from another jhtml file or to call a bean (which returns whatever the java class returns).
e.g. < droplet src="/doc/otherstuff.jhtml">
< param name="xyz" value="123">
< /droplet>
or
< droplet bean="/atg/dynamo/droplet/Switch">
< param name="value" value="bean:TranslationDroplet.xyz">
< oparam name="321">
some code...
< /oparam>
< oparam name="123">
other code...
< /oparam>
< /droplet>
We are using this all through Dynamo and iSell (Informix Product).
The java class "/atg/dynamo/droplet/Switch.java" is called from within the jhtml page and receives a parameter "value" with the given value.
However, there is also a corresponding Switch.properties file.
In this file you can have a property e.g. myProperty and give it a value.
e.g. in Switch.properties
myProperty=10
Then in the Switch.java
String myProperty
// setter for myProperty
public void setMyProperty(String newMyProperty)
{
myProperty = newMyProperty;
}
// getter for myProperty
public String getMyProperty()
{
return myProperty;
}
So when this class is instanciated bythe call by the droplet command within the jhtml page, the Switch class will look at it's corresponding .properties file automatically and the myProperty attribute will be set to 10.
My problem is that I wish to set myProperty in the .properties file to be:-
myProperty=10,12,33,45,50
then have a String array in the .java to automatically store these values when instanciated.
(edited by Cindy to add spaces in HTML tags so that they would display instead of executing)
[This message has been edited by Cindy Glass (edited September 28, 2001).]
keith tyson
Greenhorn

Joined: Sep 28, 2001
Posts: 7
The droplet example is not showing I think coz of the angled brackets, so will use round instead. It read:-
e.g. (droplet src="/doc/otherstuff.jhtml")
(param name="xyz" value="123")
(/droplet)
or
(droplet bean="/atg/dynamo/droplet/Switch")
(param name="value" value="bean:TranslationDroplet.xyz")
(oparam name="321")
some code...
(/oparam)
(oparam name="123")
other code...
(/oparam)
(/droplet)
keith tyson
Greenhorn

Joined: Sep 28, 2001
Posts: 7
Apparantely you need take the whole list as one and then split it using the StringTokenizer.
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Yep !!. I had a example ready for quite awhile but could not get onto JR.



Good luck

[This message has been edited by Johannes de Jong (edited September 28, 2001).]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Droplet Properties