Pulling in data from web form


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: Pulling in data from web form

  1. #1
    Join Date
    Nov 2003
    Posts
    8

    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]

  2. #2
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  3. #3
    Join Date
    Nov 2003
    Posts
    8
    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

  4. #4
    Join Date
    Nov 2003
    Posts
    8
    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

  5. #5
    Join Date
    Mar 2003
    Posts
    834
    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:-)

  6. #6
    Join Date
    Nov 2003
    Posts
    8
    So would I just want, instead of public static void main... to write
    Code:
    public void init(){
    ....
    
    }
    ?

    THanks,

    Jeremy

  7. #7
    Join Date
    Mar 2003
    Posts
    834
    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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center