Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP inside a javascript loop

 
manav kher
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i were to put a jsp tag inside a javascript loop say something like this
for(var i=0;i<100;i++){
<% out.println("hello world") %>
}
how will this work? will it go the server a 100 times since the jsp is processed at the server and not the client while the javascript would execute at the client?
thanks- manav
 
Maky Chopra
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what will happen is that your jsp tags will get executed at the server and the result will be sent to the client.
so you will see this at the client
for (var i = 0 ; i < 100 ; 1 ++) {
hello world
}
which will get executed.. in this case you willhave an error since hello world will be an unknown object.
If you had
for (var i = 0 ; i < 100 ; i ++) {
document.write(" <% out.write("hello world"); %> ");
} would have worked by iterating at the client side 100 times

[This message has been edited by Mak Bhandari (edited April 30, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!