Can I set a HashMap to a Variable using JavaCallout,Java Callout return a HashMap and use in a Javascript Policy

Not applicable

HI,

I have a requirement to create a HashMap in JavaCallout and use that Key/Value map to construct a

HTML Page using XSL or JavaScript.

messageContext.setVariable("test" hashMap);

If I can set a HashMap, then my next question would be is how do I access that variable in JavaScript or XSL

Can you please let me know is this possible

Thanks in advance

Solved Solved
1 4 320
1 ACCEPTED SOLUTION

Nope.

But you could serialize it as a JSON hash from Java (using Jackson, etc) and then de-serialize it in JavaScript.

If you want to access it from within XSL, then that's a different story. Tell me specifically what you need and we can explore the problem.

View solution in original post

4 REPLIES 4

Nope.

But you could serialize it as a JSON hash from Java (using Jackson, etc) and then de-serialize it in JavaScript.

If you want to access it from within XSL, then that's a different story. Tell me specifically what you need and we can explore the problem.

We are taking the JavaScript route to create the HTML Pages. Thanks for the guidance

Can you elaborate on "taking the JS route"?

Are you providing that as additional information, to continue the discussion? If so, I don't think it's enough additional information.

If you are generating HTML, I'd suggest that you use nodejs and one of the nodejs templating libraries, like handlebars, mustache, or something similar. Even if you do that, then ... you should be able to serialize the data as JSON from within a Java callout.... and then employ the data within the nodejs templating engine.

Is there still an outstanding question? I'm not sure of the status of this question, at this point.

Dino..Thanks for your guidance...I will try out your suggestions