• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

in jsp where javascript code exected?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i write jsp in that jsp i have done all validation using javascript.so when clint request through browser where that script exected on client side or server side?if client side then if my browser doesnot support java script validation what happen?
pl.reply
thank in advance
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
JSP code ( the stuff in <% %> ) is executed when the page is being built, befor eit is sent to the browser. JavaScript is executed on the browser, long after the page has been built and sent over the network.
You may be getting confused by seeing JavaScript code in amongst the HTML in a JSP. The thing to always remember is that, to JSP, JavaScript is just text which the JSP sends to the browser. JSP neither know nor cares the difference between HTML and JavaScript - it just bulds it and sends it to the browser.
[ March 03, 2004: Message edited by: Frank Carver ]
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sweety,


i write jsp in that jsp i have done all validation using javascript.so when clint request through browser where that script exected on client side or server side?


Although the JavaScript is generated by JSP in server, JavaScript ALWAYS being executed in client browser.


if client side then if my browser doesnot support java script validation what happen?


In this case, all JavaScript will NOT be executed, and all checkings will not be performed. Thus, in practice, we will do one more layer.
We first check the input from the users in the browser via JavaScript, we will also check it once again in the server-side (say Servlets) before the data is really put into the database or being process.
This is because, when JavaScript is disabled, the checking will be by-passed, and invalid data can be sent to the server which may harm the server. Thus, being doing anything, we will check it once again.
You may think that, if we check it 2 times, then, maybe the checking in browser can be removed. But this may not be the case. Since JavaScript can prompt the user immediately if the enter the wrong data. Thus, this saves the network bandwidth that every time, wrong data are only triggered by the server component.
Does this help you?
Nick.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic