0

1.)I need to set my java variable value in session.And want to get this session over Coffee Script.

Example: I have Bubble chart Screen.I am returning bubble size from java Spring Controller to Coffee Script.I need to create bubble different- different Size.I have no of Audience Segments,Each segments has different reach,I will find the max reach from higher segment,And on the bases of higher reach,i will make conditions,if reach greater than 100 than bubble size will be 50.Then set the bubble size variable in session.

My Question IS:How I can get the session value from java controller to Coffee Script.

1 Answers1

0
  1. You can write your JS in JSP(not a clean approach, will be difficult for maintanence)
  2. Store the bubble size in a hidden variable and access that variable in JS

will work?

whoami
  • 1,517
  • 1
  • 21
  • 29
  • I need to access the bubble size in Coffee Script.Is it Possible. – Pardeep Bhasin Jul 14 '14 at 12:45
  • When i get session over jsp page, that is containing bubble size variable value then how I can access this value from jsp to Coffe Script.My Coffee Script file name is vis_cluster.coffee – Pardeep Bhasin Jul 14 '14 at 12:48
  • I have not worked in Coffee script but my understanding is its a Javascript code, right? If my understanding is correct, let me know, will tell you how to get the bubble size in JS(coffee script). – whoami Jul 14 '14 at 12:50
  • I will set bubble size variable value in session and get this session over jsp page.As you previously i will add the session value in hidden form field ,On the value of id i can access this bubble size value anywhere in java script code.But my question is regarding coffee script not a simple java script file. – Pardeep Bhasin Jul 14 '14 at 12:53
  • @radius_scale = d3.scale.pow().exponent(0.5).domain([0, 10000]).range([2,85]) – Pardeep Bhasin Jul 14 '14 at 12:54
  • Above code is coffe Script Code,In place of 85 i need to pass my bubble size value.That i will get from jsp to Coffee Script.But i dont know how to get the value in Coffee Script. – Pardeep Bhasin Jul 14 '14 at 12:56
  • have you check these? http://stackoverflow.com/questions/8108511/how-to-access-instance-variables-in-coffeescript-engine-inside-a-slim-template http://stackoverflow.com/questions/8513912/rails-access-controller-instance-variable-in-coffeescript-or-javascript-asset-f – whoami Jul 14 '14 at 12:56
  • Ok I will try according to these Above links.And post my solution, – Pardeep Bhasin Jul 14 '14 at 12:59
  • Hi praki, I got a solution.Resolve my issue.Thanks alot.The solution is: First return value from controller.Get the value in session over jsp page,and put this value in hidden field,and in coffee script ,write jquery to access the value of hidden field,Now my code is working. – Pardeep Bhasin Jul 16 '14 at 07:07
  • In coffee Script we can write jquery is as follows: $(document).ready -> bubble = jQuery("#bubbleSize").val(); – Pardeep Bhasin Jul 16 '14 at 07:09