
i want to covert this php code int java/JSP.
if (isset($_POST['orders'])) {
$orders = explode('&', $_POST['orders']);
$array = array();
foreach($orders as $item) {
$item = explode('=', $item);
$item = explode('_', $item[1]);
$array[] = $item[1];
}
} I tried like this (see below JSP code) ... but this is not giving me the exact result as the above PHP code is giving. So please help me to convert it into Java.
if (request.getParameter("orders") != null) { String item = request.getParameter("orders"); System.out.println("oRDERS...."+item);
String[] arr = item.split("\\=");
item.split("\\_");
System.out.println("Length of Array is :" + arr.length);
for (int i = 0; i < arr.length; i++) {
System.out.println("array " + i + ":" + arr[i]);
}
} else { System.out.println("NOT SET"); }
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.