I have a small problem, I know how to do what I do in PHP but not sure how to achive that in JSP, can anyone help?,
basically here is my code in php:
<script type="text/javascript">
....
....
<?php
$order_items = getCurrentAttribute('confirmation','orderitems');
$order_items = explode('||',$order_items);
$fo_order_items = array();
foreach($order_items as $item)
{
$item = explode('|',$item);
if(!$item[0]) continue;
$fo_order_items[$item[0]] = array(
$item[3],(int) $item[4],$item[1]
);
}
?>
var fo_order_items = <?php echo json_encode($fo_order_items); ?>
....
....
....
</script>
and here you can find an example of how order_items variable looks at the beginning:
sku1|title1|size1|price1|quantity1||sku2|title2|size2|price2|quantity1
Thanks in advance.
P.S.
don’t worry about getCurrentAttribute() function, its already done in JSP
cheers,
/Marcin
// i guess it may help
// for json encoding look at JSON – LIB or GSON lib