0

Am trying to assign a java script element id to the integer like this,

int PAGE_SIZE =%> <script>document.getElementById('t1')</script><%;

and in my java code am assigning some dynamic value for the PAGE_SIZE varilable, Now with this id "t1" can i pass the integer value dynamically to a select box like this,

<select id="t1">

Hope you understand what am trying to say.

Kindly suggest me how to do this.

sathya
  • 384
  • 1
  • 8
  • 19

2 Answers2

1

Fundamental -

Javascript runs in client browser. and Java runs in server.

are you trying to run your javascript code in server? :)

Subhrajyoti Majumder
  • 40,646
  • 13
  • 77
  • 103
0

Transfer your id as a parameter in the url, which you could then parse in servlet || Spring MVC controller action, etc. Look at the urls with parameters, for example www.example.com?param1=1&param2=2 ..

There are some examples for you: How to pass parameter to servlet

How do I pass multiple parameter in URL?

Read about the HttpRequest and HttpResponse - should help.

Community
  • 1
  • 1
user
  • 3,058
  • 23
  • 45
  • am just trying to pass the integer value to the select box through the script element id is it possible? – sathya Dec 20 '12 at 08:43