Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-03-2008, 10:58 AM
Member
 
Join Date: Apr 2008
Posts: 3
xiongling is on a distinguished road
How to call the input value from different file?
I am doing a sever/client chat program. I wish to let the user to enter their entire name through input dialog and I want to use the name that entered by the user in client.java to be use in server.java so that it will shows "username connected to server". I wish to know how to get the username that entered by the user in client to be use in server. Hope anyone can answer me. Thanks.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 04-03-2008, 11:11 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,568
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
You asking that how to pass a value from one class to the other? I've not clear your question pal.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-03-2008, 11:27 AM
Member
 
Join Date: Apr 2008
Posts: 3
xiongling is on a distinguished road
ya, exactly like wad u say. But the class is in different java file. Able to make it?
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-03-2008, 11:31 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,568
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
It's basis in Java. Even you have two Java files(as you say server.java and client.java) there is two classes. To access from one class to the other, in simple word, you need an object of a class in the others.

So create an object of server class in the client class and using that object call a function of a server class to check the username.

Is that clear.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-03-2008, 11:34 AM
Member
 
Join Date: Apr 2008
Posts: 3
xiongling is on a distinguished road
sorry, but i don't get u. Coz i m still new to java. Can u write me an example of code of how to make it? Thanks.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-03-2008, 11:53 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 3,568
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Ok, I'll explain it in simple way as follows.


Code:
public class Client{ String username; // Get the user name through a GUI and set it to username // Object for class Server Server myServer = new Server(); myServer.isValid(username); } public class Server{ // Check that username is correct public void isValid(String name){ // Check that user name is valid, and so do the process } }
Is that clear now, or need more explanations.

Actually if you don't know how those basis things done, please spend some time with Java fundamentals. If you don't know such things to do, how can you handle a server-client application.

In a such a project you have to do much more than this, it's not going to be easy for you pal
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 04-07-2008, 11:05 AM
try try is offline
Member
 
Join Date: Nov 2007
Posts: 2
try is on a distinguished road
I think
I think, u can use socket or URL class to connect to server and pass parameter values.

Thanks,
Guddu
Java Open Source Utilities Help - Â*Â*Â* Java OpenÂ*Source Utility Help
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Taking input from Properties File bugger New To Java 4 05-07-2008 10:30 AM
calling another call file Yaya B New To Java 1 12-21-2007 07:11 AM
how to call a JAR FILE from HTML leonard Java Applets 1 08-05-2007 07:06 AM
How to remove Control Characters from an input file? renjan Advanced Java 0 08-01-2007 04:33 PM
count character in text file as input file aNNuur New To Java 0 06-18-2007 07:46 AM


All times are GMT +3. The time now is 12:55 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org