Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

servlet problem

Options
  • 16-03-2006 12:49pm
    #1
    Posts: 0


    hi i am trying to create an error on my servlet where the players chosen from selection fields are matched to those in the database. if they match then get their value. calculate the value of all players and if the total is greater then a designated budget output an error, else send on to DB..


    i thought firstly you would do something like

    //get parameters (eg string gk and string d1)
    int budget = 10;
    int sum = -1;


    if(gk.equals(p.getName()) ) {

    int g = p.getValue();

    if d1.equals(p.getName()) {

    int 1d = p.getValue());
    sum = ( g + 1d);
    }}
    if (sum > budget){
    //output error msg

    am i right??


Comments

  • Registered Users Posts: 27,163 ✭✭✭✭GreeBo


    you should name your variables something better
    though maybe gk is goalkeeper and d1 is first defender?
    You will need to add all the values so think of a way of doing the same addition multiple (11?) times just using different fields.
    Also, you know the names of the fields so maybe define them somewhere, might be useful.


Advertisement