File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to invoke servlet from HTML without form action. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to invoke servlet from HTML without form action." Watch "How to invoke servlet from HTML without form action." New topic
Author

How to invoke servlet from HTML without form action.

Siddhartha Azad
Greenhorn

Joined: Jan 03, 2003
Posts: 9
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

Joined: Jan 15, 2004
Posts: 149
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

Joined: Oct 12, 2000
Posts: 5093
piece of Javascript in the page onload event?


42
Siddhartha Azad
Greenhorn

Joined: Jan 03, 2003
Posts: 9
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to invoke servlet from HTML without form action.