Reputation: 3588
I'm "translating" a PHP class in Java.
I've a function that takes a key and checks if it's in the $_POST array.
How could I do a similar thing from a class Java method?
Upvotes: 1
Views: 2115
Reputation: 7310
Java doesn't support associative arrays. If you're using a HashMap:
HashMap hMap = new HashMap();
//(...)
ht.put("key","One");
ht.containsKey("key"); // returns true
If you're using a hashtable:
Hashtable ht = new Hashtable();
//(...)
ht.containsKey("key");
Unless you mean how to access POST parameters, then check this question and this documentation
Upvotes: 1
Reputation: 3932
Look up request.getParameter()
http://www.roseindia.net/jsp/GetParameterMethodOfRequest.shtml
Upvotes: 0