Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 20th, 2005, 02:06 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can I call a servlet from a JFram

Hi,

All I want to know that can I call a servlet from a JFrame or in general from a stand alone application instead of calling form a browser.

I have seen many applications which receive data...i.e details from Internet web sites...from a stand alone application can we also do from a JFrame or a just a Frame application.

If possible just provide me how it can be done....

is it possible to to do witu URL class???

Expecting reply
regards
Vamshi

Reply With Quote
  #2 (permalink)  
Old September 22nd, 2005, 11:54 AM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes it can be done,
creat a new URL object and pass teh path of your web application as parameter:

URL url = new URL("http://127.0.0.1:8080/WEBAPPLICATION(OR COMPLETE PATH TO THE SERVLET YOU ARE CALLING");

firas

Reply With Quote
  #3 (permalink)  
Old September 23rd, 2005, 12:56 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you firas.
I have asked many about this a I had not received a proper reply. Yes I will call the servlet in this way. Do I need to set the setContentType("text/html)--:to some thing other than this. If so please reply with parameters to be passed to the setContent Menthod.

Thank you again as this information is very usefull for me.
Regards
Vamshidhar M T

Reply With Quote
  #4 (permalink)  
Old September 23rd, 2005, 09:15 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

setContentType(); is a signal to the browser to tell what is coming, i understood you are doing a stand alone application. if you are trying to create your own browser with special features and can recognize the content type then yes you have to tell it. however if your stand alone application is only try to access the server to do some work to your web application so there is no need to that, you can rerurn what ever you want as long as your application knows what is getting.

Firas

Reply With Quote
  #5 (permalink)  
Old September 25th, 2005, 10:00 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Firas,

Thank you for U R immediate reply and taking concern abt the issue.

U have posted the reply what exactly I was looking for.
Here I have some more doubts in the same concern.
1. What if I have a small login JDialogBox which will ask for a user name and password. Aftre which I send the details to a Servlet by calling the URL constructor... and then I want a small result to be sent back to the client can I do it???
2.In the above regar can I use RMI instead of Servlet calling using a URL(). Which one is appropriae here???

Regards
Vamshidhar


Reply With Quote
  #6 (permalink)  
Old September 26th, 2005, 12:52 PM
Registered User
 
Join Date: Sep 2005
Location: , , .
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

1- yes.
2- yes, which one is appropriate? the answer depends on what you are doing and type of connection. if this is a client-server application you can use rmie, if you are feeding a web application through yours then you can use EJBs so what you feed through your application will be fed to the web application.

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Servlet Call Applet azimdgreat Servlets 2 July 16th, 2008 05:48 AM
servlet call using hyperlink tusharkale Servlets 4 October 3rd, 2007 06:02 AM
servlet shiveka Servlets 1 October 9th, 2006 08:26 PM
Need help in servlet arunj82 Apache Tomcat 0 March 15th, 2006 07:16 AM
How Can I call a HTML file from a servlet? alf.guzman Servlets 3 January 24th, 2005 04:51 AM



All times are GMT -4. The time now is 08:28 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.