Need help on AJAX in java

Hi! I'm very new to the concept of AJAX and I was hoping someone could help me out. Basically, I have an application that needs to implement AJAX to speed up the transaction.
What the program does is it has a dropdown box which has dates. After the user selects a date and clicks the submit button, the server returns a user from the database.
My question is, how do I implement AJAX here? If it is possible, please guide me with this since I barely know how and where to start.
Thanks!

dont crosspost

Similar Messages

  • Need help in my assignment, Java programing?

    Need help in my assignment, Java programing?
    It is said that there is only one natural number n such that n-1 is a square and
    n + 1 is a cube, that is, n - 1 = x2 and n + 1 = y3 for some natural numbers x and y. Please implement a program in Java.
    plz help!!
    and this is my code
    but I don't no how to finsh it with the right condition!
    plz heelp!!
    and I don't know if it right or wrong!
    PLZ help me!!
    import javax.swing.JOptionPane;
    public class eiman {
    public static void main( String [] args){
    String a,b;
    double n,x,y,z;
    boolean q= true;
    boolean w= false;
    a=JOptionPane.showInputDialog("Please enter a number for n");
    n=Double.parseDouble(a);
    System.out.println(n);
    x=Math.sqrt(n-1);
    y=Math.cbrt(n+1);
    }

    OK I'll bite.
    I assume that this is some kind of assignment.
    What is the program supposed to do?
    1. Figure out the value of N
    2. Given an N determine if it is the correct value
    I would expect #1, but then again this seem to be a strange programming assignment to me.
    // additions followI see by the simulpostings that it is indeed #1.
    So I will give the tried and true advice at the risk of copyright infringement.
    get out a paper and pencil and think about how you would figure this out by hand.
    The structure of a program will emerge from the mists.
    Now that I think about it that advice must be in public domain by now.
    Edited by: johndjr on Oct 14, 2008 3:31 PM
    added additional info

  • Need help in creating a java program

    Hi everyone.
    I'd like to say before i start about my problem, that i've only begun learning java and my teacher hasn't explained anything at all. He only showed us by doing it himself and then showing us the final version. I've searched a little on how to program but i get little success in finding a good tutorial.
    I need help creating a program which has been assigned to me due in a few days in which i can't contact my teacher for help.
    I need to write a java program which inputs 3 items. The number of kilometres you drove, the number of litres of gas you used and the price you paid for the gas. Then, the program must calculate the number of litres used per 100km driven, which is litres divided by kilometres times 100, how much it costs to drive 100km, which is the result (a) times the price per litre and the number of miles per American gallon of gas ( one American gallon = 3.785 litres, and one mile = 1.609 km.
    The program has to output my name, the inputs given, the results computed and a message saying "Program Complete".
    To give you what i've done to begin with, from what i understood, is:
    import javax.swing.JOptionPane;
    public class prog1
         public static void main(String args[])
              final double americanGallon = 3.785;
              final double mile = 1.609;
              kilometresDriven,
              gasUsed;
              priceOfLiterGas;
              System.out.println("My Name");
              System.out.println("Number of kilometres driven:");
              kilometresDriven = JOptionPane.showInputDialog ("Kilometres Driven");
              System.out.println("Number of Litres of gas used:");
              gasUsed = JOptionPane.showInputDialog ("Litres of gas used");
              System.out.println("Price of a liter of gas:");
              priceOfLiterGas = JoptionPane.showInputDialog("Price per liter");
    Up to now, that's all i've got. i know i'm wrong, but i'm not sure how to do this. Could someone give me an outline of what this program is suppose to look like?
    Thanks in advance.

    Here's an update on my program. I've worked on certain details and would need your comments whether it contains errors. I'd also want to know if it would work or not because i don't know how to check it on my computer.
    Here's the update:
    import javax.swing.JOptionPane;
    public class Prog1
    public static void main(String args[])
    String name;
    double kmDriven;
    double litresUsed;
    double pricePaidForGas;
    double priceOfALiter;
    name = JOptionPane.showInputDialog("Name");
    input = JOptionPane.showInputDialog("Number of km driven");
    kmDriven = Double.parseDouble (input);
    input = JOptionPane.showInputDialog("Number of litres of gas used");
    litresUsed = Double.parseDouble (input);
    input = JOptionPane.showInputDialog("Price paid for gas");
    pricePaidForGas = Double.parseDouble (input);
    input = JOptionPane.showInputDialog("Price of a litre of gas");
    priceOfALiter = Double.parseDouble (input);
    a = (litresUsed/kmDriven)*100;
    b = ((litresUsed/kmDriven)*100)*priceOfALiter);
    c = (kmDriven/1.609)
    System.out.println("Name:" + name);
    System.out.println("Number of litres used per 100km:" + a);
    System.out.println("Cost of driving 100km" + b);
    System.out.println("Number of miles per American Gallon of Gas:" + c);
    System.out.println("Program Complete");
    System.exit(0);
    Comments please.
    Thanks in advance

  • Need help on emailing  from java

    I need help on how to send an Email from a java application.
    Can any body help me by providing correct code for that?
    Thanks!

    It worked.Thanks!So, are you gonna award the Dukes to prometheuzz or are you donating them to the forum pickle jar?
    db

  • Im DROWNING! need help with a simple java assignment! plz someone help me!

    i need help with my java assignment, with validating a sin number. easy for must who know java. im drowning... please help!

    You will need to store each digit of the social insurance number in a field of its own. To validate the entry you will:
    1. Multiply the 2nd, 4th, 6th and 8th digit by 2.
    2. If the product of any of the four multiplications result in a value greater than 9, add the two resulting digits together to yield a single-digit response. For example 6 * 2 = 12, so you would add the 1 and the 2 to get a result of 3.
    3. Add these four calculated values together, along with the 1st, 3rd, 5th, and 7th digits of the original number.
    4. Subtract this sum from the next highest multiple of 10.
    5. The difference should be equal to the 9th digit, which is considered the check digit.
    Example of validating S.I.N. 765932546
    1st digit 7
    2nd digit (6*2 =12 1+2=) 3
    3rd digit 5
    4th digit (9*2 = 18 1+8 =) 9
    5th digit 3
    6th digit (2*2 = 4) 4
    7th digit 5
    8th digit (4*2 = 8) 8
    Total 44 next multiple of 10 is 50
    50-44 = 6 which is the 9th digit
    Therefore the S.I.N. 765932546 is Valid
    ********* SIN Validation *********
    Welcome - Please enter the first number: 120406780
    Second digit value multiplied by 2 4
    Fourth digit value multiplied by 2 8
    Sixth digit value multiplied by 2 12
    Eighth digit value multiplied by 2 16
    Value derived from 6th digit 3
    Value derived from 8th digit 7
    The total is 30
    Calculated digit is 10
    Check digit must be zero because calculated value is 10
    The SIN 120406780 is Valid
    this is my assignemtn this is what i have! i dont know where to start! please help me!
    /*     File:     sinnumber.java
         Author:     Ashley
         Date:     October 2006
         Purpose: Lab1
    import java.util.Scanner;
    public class Lab1
              public static void main(String[] args)
                   Scanner input = new Scanner(System.in);
                   int sin = 0;
                   int number0, number1, number2, number3, number4, number5, number6, number7, number8;
                   int count = 0;
                   int second, fourth, sixth, eighth;
                   System.out.print("\t\n**********************************");
                   System.out.print("\t\n**********SIN Validation**********");
                   System.out.print("\t\n**********************************");
                   System.out.println("\t\nPlease enter the First sin number: ");
                   sin = input.nextInt();
                   count = int.length(sin);     
                   if (count > 8 || count < 8)
                   System.out.print("Valid: ");
         }

  • Need help in countdowntimer in java bean for jsp page

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

    hi..im student..i need help with countdowntimer in jsp page..with java bean component..im use XHTML MP for my jsp page so i can use it in cellular phone with WAP 1..can anybody help me with this problem..thx

  • Need help with long term Java problems

    I've been having problems with Java on my computer for about a year now, and I'm hoping that someone here can help me out.
    Java used to work fine on the computer when I first got it (a Dell laptop) and I hadn't installed anything myself. But then one day it stopped loading Java applets, and hasn't worked since. By this, I mean that I get the little colorful symbol in a box when I try to play Yahoo games, use the http://www.jigzone.com site, go to chat rooms, etc. Java menus on websites like http://www.hartattack.tv used to work still, but lately they've been giving me that symbol too.
    I've tried downloading a newer version of Java, but nothing I do seems to work, and I don't know of anything I did to trigger it not working. I'm hoping there's a simple solution to this, and I'm just dumb.
    Thanks.

    This might be way off, but it's something that's tripped me up in the past:
    If you are using Sun's Java plugin, the first time you go to a site that has a particular Java applet, you may be asked to approve/reject a security request.
    If you have clicked on any other windows while the request is first being loaded (which can take some time, because this is swing based), then the security dialog box does not pop to the top of the window stack, and doesn't add an entry into the task bar.
    It appears that Java just doesn't work, but it's actually waiting for you to click "Yes". You can check this by hitting alt-tab and seeing if the Java coffee cup icon is one of the options.
    - K

  • Need help with mac and java

    Hi, I'm trying to develop an application on a Machintosh OSX 10.2.8 machine.
    I'm having a herrendous time trying to get quicktime to work on it.
    I've somehow managed t oget 1.3.1 and QTJava.jar to work together but now i need encryption, however that requires 1.4+
    Now 1.4.1 doesnt work with quicktime
    I've downloaded the latest software upgrades but Ive got no idea how to set up quicktime to work with java 1.4.1
    Now to add on top of that mac reports it can use AES encryption. this is from source code ripped striaght from this website.
    But first and foremost can anyone, annyonee help me out with setting up 1.4.1 with quicktime?
    Thank you

    If you need encryption with Java 1.3.1, download the JCE from either Sun (http://java.sun.com/products/jce/) or Bouncy Castle (http://www.bouncycastle.org/).
    Cheers,
    --Arnout                                                                                                                                                                                                                                                                                                                                                                   

  • Need help with settng up JAVA environment

    Hi:
    Can someone help me?
    How do you set up PATH and CLASSPATH?
    I downloaded the J2SDK VERSION 1.4. Then installation created the java folder j2sdk. So now all the files are in C:\J2SDK\such as lib,bin,read me right! What do I do next?
    Now how do I set my environment variables.Plus I created a new folder called Khava on my desktop to put my source code files.
    Appreciate any help
    Thanks.

    depends on ur OS. If you are running Windows 9X/2K/Me...find your autoexec.bat file. Either right-click and edit it or type "edit autoexec.bat" in DOS. In there, add to your current PATH line (or create one if you don't) that has the bin folder in it.
    So in your case, append this to the PATH= line:
    C:\J2SKD\bin
    should be all you need.
    Save and either restart the puter or run autoexec.bat. To check to see if it worked, type "PATH" in DOS and it'll display ur current path. Hope this helps.

  • I need help about algorithmics and java.

    I want to resolve the next problem:
    A technologic factory with M workers has sended N products to a conference about them.The "n" product have a list of workers which have worked in his developement and can make the presentation. Each worker have a number between 1 and N, every presentations are a in a diferent hour.The factory want than all products have presented but with the minimum number of workers.
    Implment an algorithm based of in branching to make this rule.
    THAN YOU; I NEED YOUR HELP.
    If you want to see the problem in Spanish go to:
    http://www.dlsi.ua.es/asignaturas/ea/ea.html

    You have a simple algebra problem. Break down your problem in mathematical term. Isolate each step of your problem. Solve each step in Java and you will have your algorithm.

  • Need help implementing AJAX in an existing Struts Application

    Hi!
    I am trying to implement AJAX in my existing Struts Application. I need a good approach to go ahead and implement Ajax. I was thinking.. may be i will have to club all the code in the forms n actions (in the current Struts application) to one form and action, So I can easily include the dynamic content in the page.
    Please let me know if you have any ideas of how to implement AJAX in a fully developed Struts application.
    Thanks,
    Swapna.

    Hello Friends,
    Check out whether the link below could be of somehelp for you folks...
    http://www.it-eye.nl/weblog/2005/12/13/ajax-in-struts-implementing-dependend-select-boxes/
    http://today.java.net/pub/a/today/2005/10/27/sprinkle-ajax-magic-into-struts-webapp.html
    http://www.theserverside.com/news/thread.tss?thread_id=37355
    http://getahead.ltd.uk/dwr/examples/lists
    http://www.componentsource.com/products/backbase-ajax-struts/summary.html
    http://www.jibbering.com/2002/4/httprequest.html
    added to it there are few implementation frameworks which are addressing this issue you may further search on it and update abt the info which could be very much useful for all of the ppl out here.
    and there is a current thread running on the same topic it'd really appriciated if u can accomadate ur posts there.
    http://forum.java.sun.com/thread.jspa?threadID=784924&tstart=0
    REGARDS,
    RAHUL

  • Need help with a basic java thing..

    Sorry, just started java a few weeks ago and i'm having trouble figuring out how to do something.
    I wanted to know how to make this work. It cant be more than 6 characters in length and of those six characters, the first two have to be letters only, followed by a dash (-) and then three numbers. EG: ab-234 or gf-643...
    Im using it as a serial number generator type thing, thats only one part of the entire program, but I cant figure it out.
    Just need the most basic way to do that if anyone could help! been looking for hours in a couple java books i have and dont know where to look or what to look for!!
    Any help figuring out the code for that would be great! Here's what I have so far and how i need the rest to be implemented! Thanks! PS: using TextIO
    <code>
    String itemNum1
         itemNum1 = new String ( " Enter Item Number(AB-123): " );
         TextIO.put("\n" + itemNum1);
         itemnum = TextIO.getlnString();
    </code>

    Oh hey sorry, i figured the bit of text i put in there
    would be enough. I basically need a user to enter the
    information, but i just need to know (or get a hint)
    of how to prevent them from entering an invalid
    number/serial code type thing in regards to the
    parameters that I need met. (such as no more than 6
    chars, but alternating numbers/letters). I presume I
    use the char and not the getlnString command but
    nonetheless im still stuck as to how I'd manage that.
    Do i need to code each character seperately? (such as
    letters by themselves, then another prompt to enter
    the numbers??) or is there a way to get it all in one
    go?
    Thanks for any advice! oh and Sorry for the bad
    wording in my question :P.
    You could read the String from console using something like
    public static String readWord()
       {  int ch;
          String r = "";
          boolean done = false;
          while (!done)
          {  try
             {  ch = System.in.read();
                if (ch < 0
                   || java.lang.Character.isSpace((char)ch))
                   done = true;
                else
                   r = r + (char) ch;
             catch(java.io.IOException e)
             {  done = true;
          return r;
       }you would have to modify it according to your needs and after that you could use the String API to confirm if the user has entered it right or not. If not you could ask him to do that again

  • Need help with running a Java program on Linux

    I am trying to get a Java program to run on a Linux machine. The program is actually meant for a Mac computer. I want to see if someone with Java experience can help me determine what is causing the program to stall. I was successful in getting it installed on my Linux machine and to partially run.
    The program is an interface to a database. I get the login screen to appear, but then once I enter my information and hit enter the rest of the program never shows, however, it does appear to connect in the background.
    Here is the error when I launch the .jar file from the command screen:
    Exception in thread "main" java.lang.IllegalArgumentException: illegal component position
    at java.awt.Container.addImpl(Unknown Source)
    at java.awt.Container.add(Unknown Source)
    I am not a programmer and I am hoping this will make some sense to someone. Any help in resolving this is greatly appreciated!

    Well, without knowing a little bit about programming, and how to run your debugger, I don't think you're going to fix it. The IllegalArgumentException is saying that some call does not like what it's getting. So you'll have to go in an refactor at least that part of the code.

  • Need help on guide of java mapping

    HI,
    I want to learn java mapping. I searched in blogs but I am not comfortable to understand. Can anyone explain me the step by step process.
    Thanks,
    Enivass

    Hi enivas,
    Having basic understanding about J2SE will be great help for you. Please check these links about Java Mapping step by step
    Implementing a Java Mapping in SAP PI /people/carlosivan.prietorubio/blog/2007/12/21/implementing-a-java-mapping-in-sap-pi
    XI Java Mapping Helper (DOM) /people/alessandro.guarneri/blog/2007/03/25/xi-java-mapping-helper-dom
    Debugging Java Mappings using SAP Netweaver Developer Studio /people/christian.drumm/blog/2008/09/30/debugging-java-mappings-using-sap-netweaver-developer-studio
    Handling and Tracing Runtime Exceptions in Java Mapping /people/prasannakrishna.mynam/blog/2009/07/21/handling-and-tracing-runtime-exceptions-in-java-mapping
    SAP PI Java API has changed a lot from PI7.0 to PI7.1. http://wiki.sdn.sap.com/wiki/display/XI/UsingPI7.1APIforJavamapping
    Check them out in this link Javadocs Index http://www.sdn.sap.com/irj/sdn/javadocs. Blogs mentioned use old API, but once you get idea about Java mapping switching to new API will be easy. Java help is easily available on net, use Google more. Happy learning.
    Regards,
    Raghu_Vamsee

  • Need help with rotation in Java

    Hi, I am trying to write an asteroids remake and I have gotten pretty far, but I'm stuck when I try to rotate my ship object. I have googled various formula's etc. but the code doesn't work as expected. I have posted the relevant ship.class below:
    import java.awt.Polygon;
    import java.awt.Graphics;
    import java.awt.Shape;
    import java.awt.*;
    public class Ship extends MyShape {
         Polygon body;
         //line2D.Double base;
         //line2D.Double lside;
         //line2D.Double rside;
         double dx;
         double dy;
         double angle;
         double dAngle;
         Graphics2D gg;
         public Ship(double a,double b) {
        x=a;
        y=b;
        //base=new line2D.Double(x,y,x+10,y);
        //lside=new line2D.Double(x,y,x+5,y-10);
        //rside=new line2D.Double(x+10,y,x-5,y-10);
        body=new Polygon();
        body.addPoint((int)x,(int)y);
        body.addPoint((int)x+20,(int)y);
        body.addPoint((int)x+10,(int)y-30);
        public void advance(){
        public double getX(){
             return x;
        public double getY(){
             return y;
        public void setY(int y){
             this.y=y;
        public void setX(int x){
             this.x=x;
          public void move(int delta){
          body.translate(0,delta);
           // body.addPoint(x,y);
           // body.addPoint(x+20,y);
           // body.addPoint(x+10,y-30);
        public void rotate(double x, double y, double theta){
             //body=new Polygon();
             theta=theta*(Math.PI/180);
             x=((x-(x+10))*Math.cos(theta)-y*Math.sin(theta)+(x+10));
             y=(y*Math.cos(theta)+(x-(x+10))*Math.sin(theta)+y);
                 //body.translate((int)Math.round(x),(int)Math.round(y));
                 body.addPoint((int)Math.round(x),(int)Math.round(y));
                 body.addPoint((int)Math.round(x+20),(int)Math.round(y));
                 body.addPoint((int)Math.round(x+10),(int)Math.round(y-30));
                 //g.rotate(theta,x,y);
        public void warpAround(int x,int y){
             body.translate(x,y);
        public void draw(Graphics2D g){
             g.draw(body);
    }If you could help me I would appreciate it,
    Sincerely,
    LJ
    P.s. I know its a little rough, I wanted to clean it up soon.
    Message was edited by:
    nipponman21

    Ok, I have officially given up on trying to get it to work via the mathematical definitions of a rotational transform. I decided to use the affine transform and it was MUCH easier than I thought to implement; however, the results are still unexpected, the ship actually turns and moves in a circle which is not what I want, here is the source (its a standalone app so you can compile and run it if you want) import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    public class BouncingBall extends JFrame implements Runnable, KeyListener {
        //Windows
        private JFrame frame;
        private DrawPanel pane; 
        private Thread t;
        //Game Vars.
        public Ball ball;
        public Ship ship;
        public static final int FPS = 30;
        public static final int WIDTH = 800;
        public static final int HEIGHT = 600;
        public static final int MAXSPEED = 30;
        public static double dx,dy;
        public static int theta=0;
        public BouncingBall() {
             frame=new JFrame();
             pane=new DrawPanel();
             frame.getContentPane().add(pane);
             frame.setVisible(true);
             frame.pack();
             frame.addKeyListener(this);
             frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
             initGame();
             start();
        public void initGame(){
             ship=new Ship();
             ball=new Ball();
        public void start(){
        t=new Thread(this);
             t.start();
            public void run(){
                 while(true){
                      try{
                      Thread.sleep(10);
                      }catch(Exception e){}
                      pane.repaint();
        public static void main(String[] args) {
            new BouncingBall();
        public void keyPressed(KeyEvent e){
            switch(e.getKeyCode()){
                   case KeyEvent.VK_UP:
                   dy--;
                   if(dy<MAXSPEED){
                   ship.move(0,dy);
                   else{
                   dy=MAXSPEED;
                   ship.move(0,dy);
                   break;
                   case KeyEvent.VK_LEFT:
                        theta++;
                        break;
                   case KeyEvent.VK_RIGHT:
                        theta--;
                        break;     
        repaint();
        public void keyReleased(KeyEvent e){
            switch(e.getKeyCode()){
                   case KeyEvent.VK_UP:
                   case KeyEvent.VK_DOWN:
                   dy=0;     
                   break;
        repaint();
        public void keyTyped(KeyEvent e){
        class Ball{
              double x;
              double y;
             private Arc2D.Double body;
             public Ball(){
                  x=600.0;
                  y=500.0;
                  body=new Arc2D.Double(x,y,30.0,30.0,0.0,360.0,Arc2D.OPEN);
             public void move(double dx,double dy){
                  body=new Arc2D.Double();
                  x+=dx;
                  y+=dy;
                  body=new Arc2D.Double(x,y,30.0,30.0,0.0,360.0,Arc2D.OPEN);
             public double getX(){
             return this.x;
             public double getY(){
             return this.y;
        class Ship{
              double x;
              double y;
              double angle;         
             private Polygon body;
             public Ship(){
                  x=400.0;
                  y=300.0;
                  angle=0;
                  body=new Polygon();
                  body.addPoint((int)Math.round(x),(int)Math.round(y));
                  body.addPoint((int)Math.round(x+15),(int)Math.round(y));
                  body.addPoint((int)Math.round(x+7.5),(int)Math.round(y-20));
             public void move(double dx,double dy){
                  body=new Polygon();
                  x+=dx;
                  y+=dy;
                  body.addPoint((int)Math.round(x),(int)Math.round(y));
                  body.addPoint((int)Math.round(x+15),(int)Math.round(y));
                  body.addPoint((int)Math.round(x+7.5),(int)Math.round(y-20));
             public double getX(){
             return this.x;
             public double getY(){
             return this.y;
        class DrawPanel extends JPanel{
                public DrawPanel(){
                  setBackground(Color.black);
                  setPreferredSize(new Dimension(BouncingBall.WIDTH,BouncingBall.HEIGHT));
             public void paintComponent(Graphics g){
                 super.paintComponent(g);
                 Graphics2D g2d=(Graphics2D)g;
                 g2d.setColor(Color.white);
                 g2d.fill(ball.body);
                 g2d.rotate(theta*Math.PI / 180.0);     
                 g2d.fill(ship.body);
    }Can you guys maybe run this and look over the code and tell me what I'm doing wrong? I would definitely appreciate it Thanks.

Maybe you are looking for

  • Can any one give me answer for these questions

    Can any one give me answer for these questions. I  got these questions from net plz post the answers you know ABAP CERTIFICATION QUESTIONS 1. If a table does not have MANDT as part of the primary key, it is ____. A: A structure B: Invalid C: Client-i

  • Multiple iCloud accounts with one Apple ID?

    We have 4 iOS devices in our household (2 iPhones, 2 iPads). We share the same Apple ID. Can we have more than 1 iCloud account with one Apple ID? We do not want to share our Calendars and Reminders. Thanks!

  • How to manage a data file using Business Contact Manager database tool

    I set up BCM on my desktop and now want to share with the rest of the office. I downloaded BCM database tool on the C drive of the server and all was well until I tried to move through the wizard. The only option that gets me to a data file is creati

  • Receiver SOAP Communication Channel  Error

    Hi, I am trying to post a file to a WebService but facing the below error in the communication channel : Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: SOAP: response message contains an error XIAdapter/PARSING/ADAPT

  • How to disable the frame to be moved

    On my program I use JFrame class. My problem is that I want the frame to be fixed in its place and can not be moved. Any one can help me in this.. Thanks.