This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Servlets and the fly likes Calling Servlet from  a java class  Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Calling Servlet from  a java class  " Watch "Calling Servlet from  a java class  " New topic
Author

Calling Servlet from a java class

Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi Guys,
Hi guys how can I call a servelet in java class when some method in that class finds an exception.
Thank
Neha
Prasanna KumarBP
Greenhorn

Joined: Jul 25, 2001
Posts: 21
write same code, what u do for applets :-)
-Prasanna
Kyle Brown
author
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
    
    5
If you mean "can you somehow invoke the service() or doPost()" method to display the results of the error -- the answer is no, you can't do that. You'll have to bubble the exception up to the servlet that originally was called and handle it there.
I think you might have a more interesting question here. Is your question really "how do I handle exceptions in Servlet programming and display errors properly?"
Kyle Brown
------------------
Kyle Brown,
Author of Enterprise Java (tm) Programming with IBM Websphere


Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at http://www.kyle-brown.com/ for other WebSphere information.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calling Servlet from a java class
 
Similar Threads
JavaBeans Naming Standard
accessing a java control within a static FormData class
Wrapper Class?
java class in XSL
book on classloaders