-
Pulling in data from web form
Hi,
I got bored while in my java class in school, so I started a new program to calculate fees to use eBay. One method calculates listing fees, the other calculates final value fees.
Right now, I've written the part for final value fees, and want to be able to use it outside of Eclipse... here is the main method that I have:
Code:
public static void main(String[] args) {
EbayFees auction = new EbayFees();
auction.finalValue(102.23);
}
Where it says 102.23 (the final value in $$), I want the user to input a value on a web form, where the result will then be displayed as specified in the method that does the calculation.
What I need to know is the following:
1- What do I put as the variable in auction.finalValue(); ?
2- How do I place that variable on a form (I can create a form no problem with HTML)
3- How do I call the java program from the form?
4- I'll also be needing to use check boxes for the insertion fee portion- what will I need to do there to create the check boxes?
Thanks so much for your help!
Jeremy Katz
[ArchAngel added CODE tags]
-
1- What do I put as the variable in auction.finalValue(); ?
The sold price of the item in cents i.e. as an int. A float or double will make you lose precision.
2- How do I place that variable on a form (I can create a form no problem with HTML)
3- How do I call the java program from the form?
You'll have to convert it into a JSP or applet.
4- I'll also be needing to use check boxes for the insertion fee portion- what will I need to do there to create the check boxes?
Check an HTML site. You use an INPUT tag.
ArchAngel.
O:-)
-
2- How do I place that variable on a form (I can create a form no problem with HTML)
3- How do I call the java program from the form?
You'll have to convert it into a JSP or applet.
Thanks for the response- do you know of any good online tutorials on how to do this?
Thanks,
Jeremy
-
I'm trying to make sense of what the book is telling me to make this an applet... I now have:
Code:
public static void main(String args[]){
EbayFees auction = new EbayFees();
String input = JOptionPane.showInputDialog("Enter the auction's closing price:");
double EndValue =Double.parseDouble(input);
auction.finalValue(EndValue);
System.exit(0);
}
I have loaded javax.applet.Applet
When I run this as an applet, I get nothing; when I run it as an application, the box pops up requesting the user input.
How can I either:
1- Just run the application on a web page
2- Make the applet work?
Thanks again!
Jeremy Katz
-
Applets don't work like that - they don't have 'main' methods - they have 'init' methods. Take a look:
http://java.sun.com/docs/books/tutor...plet/overview/
ArchAngel.
O:-)
-
So would I just want, instead of public static void main... to write
Code:
public void init(){
....
}
?
THanks,
Jeremy
-
Yes, but I'm getting the feeling you're groping around in the dark - read at least some of the tutorial.
ArchAngel.
O:-)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks