1.) You must close all connections in a finally block or use the try with resources construct.
2.) if (rs.next()) moves to the first record in your resultset. So if you are doing while(rs.next() ) in the method resultSetToTabl eModel then you are skipping the first row because you are calling rs.next twice before accessing the data. Remove that if(rs.next()) check.
User Profile
Collapse
-
You need to know how many spaces are required for the most bottom child before you start printing the root node because you must print the root node after adding enough spaces to cover the leftmost child.Leave a comment:
-
You should use code tags when posting code. So what is the problem you are having with the code? Does it compile? Does it show errors when you run it?Leave a comment:
-
It tells the compiler that the set only contains objects of type Integer so there will be compilation errors if you try to add e.g Strings to the set.Leave a comment:
-
You wrote public void TempConv() //constructor which is not correct. A constructor should have no return type at all. Instead you have void which makes it just a normal method. Change it to justCode:public TempConv()
Leave a comment:
-
-
Where in the report? If this is just to get data then just call the procedure in the SQL for the report the same way you would call it from SQL.Leave a comment:
-
You are not assigning the value that was calculated in the weeklyPay method to any variable. So it is just being lost. Assign it to a variable with
Code:double weeklyPay = emp.weeklyPay(hWorked, hourlyPay);
Leave a comment:
-
You are not using the result of the weeklyPay method in your calculation of the monthly pay.
Did you instead mean
Code:double weeklyPay = emp.weeklyPay();
Code:emp.monthlyPay(weeklyPay);
Also, your weeklyPay method in the Employee class takes two arguments of type double but you are calling it without passing any parameters? Are you sure you posted the code that you ran?Leave a comment:
-
It's just creating a string by concatenating strings with other values.Leave a comment:
-
1.) Use code tags when posting code.
2.) Don't say "I have some error". Read the error message that you got. What did it say? Post it here if you don't understand it. The error messages you get from the compiler are very important because they tell you what is wrong and how to fix it, so read them.Leave a comment:
-
-
You have
Code:CarRental rentIt = new CarRental(name, zipCode, carSize, daysRented); rentIt.display();
Leave a comment:
-
-
1.) You can't use swing for the server. It's for developing user interfaces only.
2.) Before using swing for the interface, think about how you are going to deploy the interface program to the client. The usual approach would be to use Java webstart. Make sure you understand all that is involved with that and that you are comfortable with it before finalizing on using swing. Make a comparison with advantages and disadvantes of using swing vs...Leave a comment:
-
1.) You are calling the display method on the Car rental object but the method is not in the Car rental class. So move that method to the CarRental class.
2.) If you want to be able to call that method outside that class then you need to make it public too.
3.) You have a lineCode:double days = (double)daysrented;
4.) You have another...Leave a comment:
-
1.) Do not write database connection code in a JSP. Put it in a normal Java class and test that it works before writing your JSP. Then call that code from a servlet.
2.) Don't ever doCode:catch(Exception e){}
Leave a comment:
-
-
-
1.) Use standard Java conventions for naming class files. Class names should start with an upper case letter.
2.) Put your servlets in a user defined package.
3.) What link did you specify in the JSP for the submit? It needs to match the value of the mapping you have in your web.xml.Leave a comment:
No activity results to display
Show More
Leave a comment: