Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8974617
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T18:43:03+00:00 2026-06-15T18:43:03+00:00

I have a small problem, I know how to do what I do in

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T18:43:04+00:00Added an answer on June 15, 2026 at 6:43 pm
    String items[] = order_items.split("||") ;
    
    List<String> list = Arrays.asList(items); 
    HashMap map = new HashMap();
    for( String i : list )
    { 
        String it[] = i.split("|");
        if(!it[0].equals(null)) continue;
         map.put(it[0] , new Object(){ it[3] , it[4] , it[1]});
    
    
    }
    

    // i guess it may help
    // for json encoding look at JSON – LIB or GSON lib

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing a small problem. As we all know, if you have more
have small problem, and would very much appreciate help :) I should convert byte
I have small problem with Spring MVC. Basically what I'm trying to do is
I have a small problem which i can't seem to figure out. I tried
I have a small problem which i can't seem to solve myself. Look at
I am having a problem with jQuery and PHP that I can't figure out.
I know there's a json_encode on php. currently we are using that. But it's
Hey Stack Overflowians, I have a beginners problem for PHP which I've not had
So, I'm making a small application, but I ran into a problem. Basically, I
I have written a small PHP file that gets the information that was posted

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.