Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to invoke servlet from HTML without form action.

 
Siddhartha Azad
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I need to invoke a servlet from an HTML page withoug having the user to press anything. I could use the redirect tag but I don't wanna do that since thats an additional step the user can view.
Is there a way to invoke the servlet automatically?
Thx, Sid.
 
Jeffrey Spaulding
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Create a fake img tag and write the Servlet's URL into the src attribute.
Set height and width to 1 and you're done.
I have a cunning plan...
Bye, J.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
piece of Javascript in the page onload event?
 
Siddhartha Azad
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep, onload would do it. But really sweet idea Jeffrey!! Thats kinda what I was looking for since I had to avoid javascript.
Thx, Sid.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic