Sefran2
Sefran2

Reputation: 3588

php $_POST array: what in java?

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

Answers (2)

MMM
MMM

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

Ynhockey
Ynhockey

Reputation: 3932

Look up request.getParameter()

http://www.roseindia.net/jsp/GetParameterMethodOfRequest.shtml

Upvotes: 0

Related Questions