Win a copy of High Performance Python for Data Analytics this week in the Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Jj Roberts
  • Carey Brown
Bartenders:
  • salvin francis
  • Frits Walraven
  • Piet Souris

JSP inside a javascript loop

 
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic