aspose file tools*
The moose likes Servlets and the fly likes  getInitParameterNames(); Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark " getInitParameterNames();" Watch " getInitParameterNames();" New topic
Author

getInitParameterNames();

Zach Burke
Greenhorn

Joined: Feb 18, 1999
Posts: 3
Hi ,
I have a servlet that uses this method to get the Names of the Parameters.
However it doesn`t seem to write the parameters to a file in order as they appear on the web page
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20271
    ∞

And that's bad?

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Zach Burke
Greenhorn

Joined: Feb 18, 1999
Posts: 3
Well is there any particluar reason that they are written to file out of order,as I`d like to know what I may be doing wrong .
Or is this a normal thing.?
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
This is well known behaviour. The key thing to remember is that parameters, be they init parameters or from any other source, are stored internally as a Hashtable. [don't be surprised if seems they are actually stored in a Dictionary or a Properties, they're the same thing ]
Now the key thing about a Hashtable is that it is optimised for fast and simple retrieval of single entries, and part of the cost of that is that the order of the entries is lost. In cases which really need a Hashtable which preserves ordering, there is a new data structure as part of the Java 2 collections API.
In this case though, yes it is normal for them to come out in a different order, but this is OK, because the order shouldn't be important to your code.
Please let me know if the order is important, and we can sort out a solution for you here.

------------------
--
Frank Carver
[ Personal: frank@efsol.com http://www.io.com/~efficacy ]
[ At Work: frank.carver@bt.com tel +44 (0)1473 227371 ]

Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
Kalyan Ayyagari
Greenhorn

Joined: Aug 04, 2003
Posts: 5
I couldn't help noticing the timestamp of the posts on this perticular thread - February 1999???
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8898

Yes.. I find old threads topping in several forums..looks like some bug in javaracnk implementation


Groovy
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: getInitParameterNames();
 
Similar Threads
method-params problem
Special characters with query string
forwarding request to some other server
passing a single value from link to action class
Context param values from web.xml