File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes return value from java method to servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "return value from java method to servlet" Watch "return value from java method to servlet" New topic

return value from java method to servlet

Deepak Chawla
Ranch Hand

Joined: Nov 19, 2003
Posts: 50
I have a java class where i am using 1 method to insert values in database , after that insertion, i want to return something from that method to servlet and that servlet should display that information is added.
i can get the information display but i don't know what to return and how that retun value will work in that servlet.
plz help
Sim Raina
Ranch Hand

Joined: Nov 20, 2003
Posts: 33
u mean that u have a method and a servlet is calling that method and whatever the method is returning , u don' know what that is?
is that what u are asking?

if u can't impress people with ur intelligence , confuse them with ur bullshit
Sri Basavanahally
Ranch Hand

Joined: Oct 07, 2003
Posts: 75
I am not sure what the "big picture" here is, in other words may be there is a better way to do what you are doing. But, in general a servlet responds only to a client request on the web.
Is this a web application ?

Brian R. Wainwright
Ranch Hand

Joined: Aug 12, 2003
Posts: 92
If I understand you correctly, you want a message to display in the user interface that says something like, "Update completed successfully" after the update has ocurred. So you have your servlet that calls a method that updates the database and returns the success or failure of the update to the servlet (or that's what you want to happen). More info is really neccessary about the structure of your application to be able to provide you with a really thorough response. Are you using JSP's or is your servlet writing HTML out to the client? Is the databse update code in the servlet itself?
Deepak Chawla
Ranch Hand

Joined: Nov 19, 2003
Posts: 50
thanks everyone i got the answer.
I agree. Here's the link:
subject: return value from java method to servlet
jQuery in Action, 3rd edition