File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Sockets and Internet Protocols and the fly likes Can Desktop application communicate with Web Page? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark "Can Desktop application communicate with Web Page?" Watch "Can Desktop application communicate with Web Page?" New topic
Author

Can Desktop application communicate with Web Page?

vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi friends,
Here I got a situation.
1. I am having a login page of site with two entries namely username and password.
2. And a desktop application that should automatically enter the value to the above mentioned two text boxes( username and password) when I click the submit button of the desktop application.

How shall we do it.. How we can make the desktop application to communicate with web application.


vinoth


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61769
    
  67

You can use the classes in the java.net package to generate requests, or make it easy on yourself and check out the Jakarta HttpClient project.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi Bear ,
You are telling about passing the value through URL but I want that desktop application to enter the value in both the text boxes and then press enter


vinoth
Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 201
Assuming the web application is a Java implementation, you can have a call to a servlet from your Desktop application. The servlet in turn creates a bean(UserBean) and then having a JSP which use that bean(Created by the servlet) to fill the text boxes for you.

Remember, the servlet has to create a bean and forward the request to JSP.

I hope it helps.

Regards,
Girish
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
HI Girish,
Thanks for your reply . How can my desktop application will call the servlet.

I just want my desktop application to enter the values in that two text boxes. Hope you got my requirement.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42950
    
  70
vinoth ramanathan wrote:You are telling about passing the value through URL

No, both approaches mentioned by Bear can generate POST requests just as well as GET requests.
Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 201
Hi,

You can simply use HttpURLConnection class to create a connection to a servlet...




After setting some more attributes of this connection you can construct theparameters that you need to pass to the servlet as shown here.

Your servlet then handles further processing of data.

Regards,
Girish
vinoth ramanathan
Greenhorn

Joined: Oct 01, 2009
Posts: 22
Hi Girish,
Thanks for the very clear example you sited. But how do I know the name of the parameter. Suppose you are creating website with login page in that page I want to login using that desktop application. How shall I do then.
Girish Vasmatkar
Ranch Hand

Joined: Apr 24, 2008
Posts: 201
Hi again,

You are the one who is going to mention the login parameters in the JSP page. And since you are the one who is developing the desktop application as well you can easily those login parameters in the desktop app while you are creating an HttpConnection.

Regards,
Girish
dhaval yoganandi
Ranch Hand

Joined: Jun 06, 2009
Posts: 35

vinoth ramanathan wrote:Hi friends,
Here I got a situation.
1. I am having a login page of site with two entries namely username and password.
2. And a desktop application that should automatically enter the value to the above mentioned two text boxes( username and password) when I click the submit button of the desktop application.

How shall we do it.. How we can make the desktop application to communicate with web application.


vinoth




Hi vinoth,

Sorry to asking this question here.. But I am curious to know the real world application of this question. Can you justify it ?


a.k.a stalker.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can Desktop application communicate with Web Page?