1

I have retrieved the value of postCode and assigned the same in

document.getElementById("zipCode").innerHTML=postcode;

I am able to access the same using <div id="zipCode">. I want to store the value of ZipCode in a variable or a dsp:param value in JSP such that i can pass this value in my nested JSP(s). Any help regarding this will be highly appreciated.

vjy
  • 1,184
  • 1
  • 10
  • 24

3 Answers3

2

You can't do that.

Where as javascript plays on browser i.e on client side.

And jsp plays on server side. I.e Server side.

Inorder to pass that variable to serverside(jsp or what ever you have to make a request).

Suresh Atta
  • 120,458
  • 37
  • 198
  • 307
  • Any alternate way to store the value in JS itself and then use in JSP later? – Subhadeep Bose Jun 26 '13 at 08:48
  • Unfortunately no.Even they are nested jsp(s) ,they all evaluate on server comes to client.If you want to send some data to server from client,you have to make a request. – Suresh Atta Jun 26 '13 at 08:50
0

Why dont you fill an hidden input on your form, than, when you submit the form a param with this hidden input name will be passed together, than you will be able to get this parameter with dsp:param.

0

I finally figured out a solution for the same. I stored the value in a Cookie through Java script and in turn used the Cookie in my Java class to retrieve the Cookie Value.