aspose file tools*
The moose likes Servlets and the fly likes calling a servlet from the Java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "calling a servlet from the Java application" Watch "calling a servlet from the Java application" New topic
Author

calling a servlet from the Java application

Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Hello friends,
First of all a very happy New Year to all of you.Hope this New Year brings lots of joy and prosperity to everyone's life.
Now the question:
How do I call a servlet from my Java application?
I have developed a swing application whic is asking for the username and password.Inorder to verify the username and password I want to call the servlet,once he clicks on the login button and then he is redirected to a particular URL.Please reply soon as it is preety urgent.
Regards,
Kavita.
Preethi Suryam
Ranch Hand

Joined: Nov 17, 2000
Posts: 92
hi,
Happy New Year....
coming to u r doubt i think u can use URL class for invoking a servlet.please be clear about u r redirection part..so that i can help u.
Regards
preethi.
Kavita Ghia
Ranch Hand

Joined: Oct 10, 2000
Posts: 91
Hi Preethi,
what I mean about redirection is the authenticated user will be sent to a particular html page.Hope this clarifies the question.
Thanks.

Regards,
Kavita.
Kevin Mukhar
Ranch Hand

Joined: Nov 28, 2000
Posts: 83
There is an example in the Java network tutorial at http://java.sun.com/docs/books/tutorial/networking/urls/index.html which shows how an application can connect to a url.
There's an example at http://pages.about.com/kmukhar/ showing how an applet can connect to a servlet. The code will work the same for application to servlet.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: calling a servlet from the Java application