• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Can I call a Servlet from Javascript after running local code?

 
Bartender
Posts: 1876
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I need to run some client script before (or after) posting to a Servlet from a JSP page.
Can this be done?
I tried to include a javascript tag in a JSP page and it didn't load.
Thanks in advance.
-- Mike
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you want to run some js before submitting the page (say validation), you can implement the onSubmit function of the button that calls the page. Return true if you want the submit to occur and return false if you do not.
If you want to run some js after the page has been returned by the server, implement the onLoad method of the <body> tag.
The browser does not know and does not care if you use JSP, ASP, PHP or whatever else you can think of. If just gets content (usually HTML) back from the server and renders it.
If you are using the <SCRIPT language='javascript'> tag and it is not working, verify the path of the file you specify is corrrect. That will also cause the problem.
 
Mike London
Bartender
Posts: 1876
17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks!!!
-- Mike
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Again, nothing to do with servlets.
I'm moving it to the HTML forum in case someone does a search in that forum for a similar problem.
Dave
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic