Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 4th, 2006, 9:20 AM   #1
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Java and Web Pages

I've got this java program which needs to be able to enter data in a textbox on a web page. Shown below,




Is there a way that I'd be able to enter data in the textBox (marked 'something') and then hit the "Submit Query" button without the user seeing me do this?

I'm doing this because on that web page a PHP program will run and calculate a highscores list for my game.

Does Java have this sort of capability?
__________________
Death smiles at us all. All a man can do is smile back.

Last edited by Eric the Red; Jul 4th, 2006 at 9:38 AM.
Eric the Red is offline   Reply With Quote
Old Jul 4th, 2006, 10:23 AM   #2
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
Learn the name of the fucking programming language you're using before you ask questions.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials.
--WilliamSChips on Slashdot
uman is offline   Reply With Quote
Old Jul 4th, 2006, 10:25 AM   #3
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Quote:
Originally Posted by uman
Learn the name of the fucking programming language you're using before you ask questions.
What the heck is your problem? You mean Java?
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old Jul 4th, 2006, 10:38 AM   #4
coldDeath
Expert Programmer
 
coldDeath's Avatar
 
Join Date: Aug 2005
Location: UK
Posts: 862
Rep Power: 3 coldDeath is on a distinguished road
Send a message via AIM to coldDeath Send a message via Yahoo to coldDeath
I think uman is refering to the fact that you may be confusing Java and JavaScript, two completely different languages.
__________________
Join us at #programmingforums @ irc.freenode.net!

My software never has bugs. It just develops random features.
coldDeath is offline   Reply With Quote
Old Jul 4th, 2006, 10:41 AM   #5
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Quote:
Originally Posted by coldDeath
I think uman is refering to the fact that you may be confusing Java and JavaScript, two completely different languages.
I'm not confusing the two actually. In fact, this all has to be done with a java applet.
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old Jul 4th, 2006, 10:53 AM   #6
nemesis
Programmer
 
nemesis's Avatar
 
Join Date: Aug 2005
Location: Bristol, England
Posts: 71
Rep Power: 3 nemesis is on a distinguished road
Send a message via MSN to nemesis
If your using a java applet then surely this would not be difficult. You would have the text box and button in the applet, then you can do what ever you want with them.

But if you want php and java to send data to each other then i think its probably impossible. But i could be wrong.

I think you should go find out what java applets can really do, and then find out that there are easier ways. I dont quite understand why you want to do what you are doing? Maybe if you explain with some code and more detail people wount swear at you.
__________________
Bite My Shiny Metal Ass
nemesis is offline   Reply With Quote
Old Jul 4th, 2006, 11:09 AM   #7
uman
Expert Programmer
 
Join Date: Dec 2004
Posts: 794
Rep Power: 4 uman is on a distinguished road
Sorry, I assumed you were confusing Java with JavaScript like countless retards who come in here. My apologies.
__________________
Few people deserve to be compared to (Rush) Limbaugh, most of them were convicted at the Nuremburg trials.
--WilliamSChips on Slashdot
uman is offline   Reply With Quote
Old Jul 4th, 2006, 11:22 AM   #8
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Not a problem.

Here's the html code for the page:
<html>
<body>
<form action ="action.php" method="post">
<p>Your name: <input type="text" name="strname"/></p>
<input type="submit"/>
</body>
</html>

Here is action.php called by the main page (which is irrelevant to the java program) but you asked for it here it is.
html>
<body>
<?php
$strname=$_POST['strname'];
print "you typed:$strname";
?>
</body>
</html>
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Old Jul 4th, 2006, 11:27 AM   #9
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
You want to take a look at how HTML forms work. When you hit the submit button the information in the textbox is packed into a url and sent to the webserver by your web browser. All you have to do is make that URL programatically instead of having the web browser generate it.

I am not sure but I think the URL looks something like below
http://www.mywebpage.com/mypage?myTextField=10
Just do a little reading on how html forms work and you should be able to figure out how the information should be placed into the url.

Edit, I saw your new post: What you have to do is submit an html POST request and I believe the url should be:
http://www.thewebpage/page?strname=198
Where 198 is replaced with the score you want to manipulate.

EDIT: Updated the the last edit for clarity.
Game_Ender is offline   Reply With Quote
Old Jul 4th, 2006, 11:30 AM   #10
Eric the Red
Hobbyist Programmer
 
Eric the Red's Avatar
 
Join Date: Feb 2006
Posts: 214
Rep Power: 0 Eric the Red is an unknown quantity at this point
Thanks Game Ender. I'll try it out.
__________________
Death smiles at us all. All a man can do is smile back.
Eric the Red is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 12:36 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC