• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

check this out!!

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi everyone,
i simply want to use an javascript array ina jsp code.
my requirement is i want to use the values of an arrar of javascript in jsp.
i tried
<%t1.add(%><script language="javascript">document.write(a1)</script><%)%>
where a1 is the java script array
and t1 is the java object which uses a1 to call a method "add".
thanks
asheet
 
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anand,
We can't break the scriplets like this. The java code inside scriplets should atleast be an eligible java statement. We can't break a function's argument alone.
Also try to minimize the java code in jsp. jsp is meant to be used for presentation. It will be a huge head-ache if we mix and scatter lots java code within html/javascript code!
Even if you are responsible for the whole appn development, when we re-visit the code after few months, we may not get the logic easily. It could be a huge maintainence nightmare.
Javascript is going to run in client's browser and jsp scriplet will run at server. If we break the scriplet like above, how the code can run at server? Because the javascript will not be able to run and give argument values to your t1.add(...) method. Isn't ?
regds
maha anna
reply
    Bookmark Topic Watch Topic
  • New Topic