Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

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: 6920
  • 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.
 
Montana has cold dark nights. Perfect for the heat from incandescent light. Tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic