javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Are you saying that you want something like this:

<input type="text" ... class="<%=classVariable%>" style="<%=abc%>">

<td class="<%=someOtherCcsClass%>">
 some data
</td>

That can also be done using javascript. You can change those attributes using javascript at the client.
If I still don't understand your problem then post some code but if the above is what you want then let me know.

Also there aren't any JSP variables. Those are java code that are executed at the server and then the result which is a static page is loaded at your browser (client). Once the page is loaded then you are at the client and you use javascript with what you've got.

Waiting for reply

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you get any errors? Place some debug messages and see what happens. The best thing you can do is print the query that you run and try to run at the database.

public static void res(int m1)
{

String dataSourceName = "questions";
String dbURL = "jdbc:odbc:" + dataSourceName;

try { 

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection(dbURL, "",""); 

String query = "INSERT INTO Final " +"(candidate, marks) "+" VALUES "+"(' "+ user +" ' , ' " +m1 +" ' )";

System.out.println("Query:>"+query+"<");

Statement s = con.createStatement();
int i = s.executeUpdate(query); 
System.out.println("Rows updated: "+i);
//ResultSet ps = s.getResultSet();

System.out.println("Is it done??");

}


catch (Exception err)
{
err.printStackTrace();
System.out.println( "Error: " + err.getMessage() );
}

}  // function ends

After you have made those changes to your code, here are your mistakes.
You don't close anything!!!! You must close whatever you open. In order to do that you need to close them in a finally block to make sure that they are always closed:

finally {
   con.close();
   s.close(); // the statement
}

But since those are declared inside the try the above code will not work because they are not visible outside it. Also the close operation also throws an exception so you need to put that in a try-catch as well:

public static void res(int m1)
{

String dataSourceName = "questions";
String dbURL = "jdbc:odbc:" + dataSourceName;

// Declared outside the try so they can be used inside the try and the finally
Connection con = null;
Statement …
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If you have that js variable, just display it using javascript. No java is involved. Assuming that you call a javascript function that calculates the resolution and you have that javascript variable calculated at the client. Then:

<script>
  function clacRes() {
    // when this function is called at client side you get the resolution

    var res = 100;

    document.getElementById("resolution").value = res;
  }
</script>

<input type="text" name="resolution" id="resolution" value="">

You can make the input to be readonly, or put it in a div tag:

<div id="resolution"></div>

At the above case where you have a div, the javascript would be:

document.getElementById("resolution").innerHTML = res;

Check the tutorials at:http://www.w3schools.com/default.asp

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

First of all.
You don't need this:

onsubmit="javascript:return onClick()"

The javascript: is used only if want to execute javascript when you click a link. For simple events use:

onsubmit="return onClick()"

Second. You have everything in your first form, but the button that submits it is in another form. You have this:

<form name="form1" action="Details.jsp" method="post" onsubmit="javascript:return onClick()" >

....
  <input id=submit1 type=submit value=Submit name=submit1>

<form name="form1" action="PageTwo.jsp" method="post">
</form>

You open a form tag, you don't close it and inside it you open-close another.
You should have everything you want to submit in ONE form:

<form name="form1" action="Details.jsp" method="post" onsubmit="return onClick()" >

....
  <input id=submit1 type=submit value=Submit name=submit1>

</form>

You can multiple forms if necessary but you must open-close them and each must have one submit button with its own data:

<form name="form1" action="page1.jsp">
  ... input tags ...
  <input type="submit" name="subm1" value="Submit 1">
</form>

<form name="form2" action="page2.jsp">
  ... input tags ...
  <input type="submit" name="subm2" value="Submit 2">
</form>

When you click submit1 then the first form will be submitted and if you click the submit2 the second form will be submitted.
But you need only one. So keep your code and have one form that opens/closes with one submit button.

Now after you submit to another jsp or servlet, you can take the values entered like this:
Put this code to the jsp or servlet that you submitted to.

String origin = request.getParameter("Origin"); // as argument use the name of the tag

Also in your code …

peter_budo commented: Good reply +15
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you know how to run queries using java? Search this forum for examples. Then have in a separate class a method that will run your query and return the data from the DB. Then call that method from the jsp.
Once you have tested your method, you can use a select box for the drop down list.

First do the method for the database and post some code. Then we will see how you can make that dynamic list

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

if you mean like the "file" menu in word etc

http://download.oracle.com/javase/tutorial/uiswing/components/menu.html

its called a menu bar, otherwise JCombo box

Actually those are 2 different things.
The menu is used like you said for the tool bar at the top of the window (File, Edit, View)

The JComboBox is for selecting one or multiple items from a list. Like when you enter your age and you have a drop down list with all the months so you can select one.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

By the way I just noticed that you loop the array the wrong way:

for(int i=0; i<rows; i++) {
  for(int j=0; j<i; j++) {
   System.out.println(finalTemp[i][j]);
  }
}

You have at the inner loop: j<i Why? Why do you set the upper limit to be i? It should be the length of the array you are trying to read. With the way you have it, the first loop will not print anything since i would be 0. The next loop will print only one element. You need to put the length of the array. At the outer loop you put the length of finalTemp but in the inner loop the array you are looping is: finalTemp:

// rows is in fact finalTemp.length
for(int i=0; i<rows; i++) {
  for(int j=0; j<finalTemp[i].length; j++) {
   System.out.println(finalTemp[i][j]);
  }
}

finalTemp is also an array and you want to print its elements: finalTemp[j] . So its length would be: finalTemp.length

I assume that since the thread is marked as solved you have corrected that error on your own. But in case you didn't I posted

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

For gui interfaces using java there is the JComboBox class. You need to read the GUI tutorials at the sun site, or check the API. For examples search the net or tutorials

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Forget about the (String [][]) it seems that it doesn't work. Try to do it manually like I suggested:

int rows = myDouble.size(); // number of lines of the file.
finalTemp = new String[rows][];

for (int i=0;i<rows;i++) {
  String[] arr = (String[])myDouble.get(i); // each element of the list is an array
  finalTemp[i] = arr; // the ith element of the finalTemp 2D array is an 1D array
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

hmm, I dont have that error, finalTemp = (String [][])myDouble.toArray(); works fine...

Maybe it has something to do java version. After all the toArray is supposed to return a 1D array. Even if each of its elements would be another array.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to convert the list to an array after you have read the file. What is it doing inside the while. First read the file and put it into the list. Then outside the while after reading the entire file, convert it into a 2D array. Also if the (String [][]) doesn't seem to work use the second approach:

while ((str = in.readLine()) != null)	//file reading
            {
				str = str.trim();
				temp = str.split(",");
				myDouble.add(temp);
            }

// Now that you have the myDouble convert into an array:
int rows = myDouble.size(); // number of lines of the file.
finalTemp = new String[rows][];

for (int i=0;i<rows;i++) {
 String[] arr = (String[])myDouble.get(i); // each element of the list is an array

 finalTemp[i] = arr; // the ith element of the finalTemp 2D array is an 1D array
}

Remember the finalTemp is a 2D array, the finalTemp is an 1D array, the finalTemp[j] is a String.
Now print the finalTemp array using for loops and see what values it has. Compare them with the data of the file.
Don't continue until you have successfully finished with the file reading. Once you are ok, just for loop the 2D array, convert each of its elements into a number and put that number into an new double array that has the same size as the finalTemp.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

After you read the first line of the file, don't add it to the list. It's that simple. Or add that if statement where you add elements to the list.

if (!line.equals("Name Age")) {
  // add to the list
}

And don't compare the list with a String: list.equals("name is age years old") list is not a String. Don't do that. Also the coding is wrong because by the time you reach that point the list has all the elements of the file, so it will never have only this value:
"name is age years old"

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Oh what about parsing it? You did not include the parsing into double part.

It's not that difficult to add this:
Double.parseDouble in the code, wherever you want it to happen.

You can do it after you got the 2D array of before. You can parse the input, create an 1D double array and add that to the list.
With that code given it's up to you to add the parsing. I am not going to do the whole thing, you need to put some of work. If you want double just create a double array parse the values inside it and then continue using those arrays. Do some thinking on your own.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1

I was out for awhile. Sorry about that. I tried implementing your code and I get ArrayIndexOutOfBounds on the line that has

age = line[1];

Can this be done w/o using array? I don't think we're supposed to use them for this assignment.

For the ArrayIndexOutOfBoundsException I think you should have used this method:
scan.hasNextLine() instead of scan.hasNext()
But you should wait for apines comment, since it's his code.

For the other bug, try to add some System.out.println where you read the file and add elements to the list in order to see what is read. If the error still remains, just ignore the first line.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

After looking at the code:
In the displayPeopleWithSameAge method, you are comparing the input with the current. But one is a String and the other a PersonNode.
Also you haven't implemented the equals method in the PersonNode class. Try this:

public String displayPeopleWithSameAge(String input) {

for(PersonNode current = head; current != null; current = current.getNext()) {
     if (input.equals(current.getAge())) {
         output += current.toString() + "\n";
     }
   }
   return output;
}
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you post some code? The best way to do this is not just print the messages, but save the results of the file in a structure. An array or a list. Then loop the list for the display. When the user enters the age then loop again and print only those with that age.

So, where is your code?

minimi commented: Great help!!!! +1
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Okay I have a problem now. I need to change the way I want it to be.
Firstly, I want to read the text file, then store all my numbers in the text file into a 2D array.
Secondly, after storing them in a 2D array, then I parse them.

May I know how to do that?

Do you mean that the first 2D array will have the values of the file as Strings and then you will loop the array?

In case you have most of the code. I will post part of what you have done with some suggestions. You must remember first that you can add whatever you want in ArrayLists even arrays:

ArrayList fileList = new ArrayList();

BufferedReader in = new BufferedReader(new FileReader("C:\\Users\\Serene\\Documents\\Major Project\\Alignment Algorithms\\Testing2.txt")); //reading files in specified directory

 
String line = null;

while ((line = in.readLine()) != null) {
   line = line.trim(); // get rid of trailing spaces: " 1,2,3 " becomes: "1,2,3"
   System.out.println("Line is: "+line); // for debuging

   String [] arr = line.split(","); // now you have an array of {"1","2","3"}

   fileList.add(arr); // the list has all of the arrays
}

// There is a method that converts a list into an array. If the list has values "a", "b", "c" that method will return an array of {"a","b","c"}
// So by using that method you will get an array of arrays, which is a 2D array in java:

String [][] finalArr = (String [][])fileList.toArray();
// each row of …
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

From what you said, you make it sound like that you close the connection when the use logs out; Which is wrong.
The rest seem correct, but since your description is kind of vague here is a small suggestion:

In a method:

{
open connection
validate username, password given
close connection and everything else opened (ResultSet, ...)
return true/false
}

When trying to login call that method. The method needs to be put in a separate class.

Depending on what returned:
- Log in
- Put username in session.

Upon logout:
- Remove username from session.
- Invalidate session

But the connection needs to be closed immediately when done using it. If you need to run something else open a new one. But don't keep it open throughout the session.


You are probably already doing what I just said, but just in case I misunderstood what you said, I offered my version of login/logout

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

When the page loads, if you have the color and you set it to the value of the select box then also set it at the row. Can you post the code where you set the selected option of the select box with the color, so we can get a better view on what you are doing.

Also don't use java to generate html tags like you do it at the method getColor. Everything about displaying and tags should go in the jsp.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

you know one thing ... u are very RUDE to your juniors...

It is true that I am a beginner but if u think u r expert in java that's good it is the confidence.. but dont think that u are the only person who is expert in java (over confidence).
one good suggestion 4 u.. try to be HUMBLE!

thanks

So the fact that you ignored my suggestion and went behind my back to create a new thread in a different forum was very noble?

Have you tried the things I told you? Have you written any code? What have you done so far?

I never said I was an expert, but when I was a newbie, we didn't have internet for others to give us code. We had to read books! I read a book to learn what you can easily find by searching the forum.

I am not being general:
The code that you want can be found by searching this forum. Do we have to do the search for you?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You have already been given an answer for this question at this thread:
http://www.daniweb.com/forums/thread323756.html

If you didn't like the answer don't double post because you will get the same answer. Follow the steps at the previous thread and do some studying. We are not going to study for you or give you the code especially when that code can be easily found with a simple search, since there are plenty of examples in this forum.

If you are not willing to do some research on your own then don't expect others to get into that trouble.

Also does your project involve javax.swing GUI or web application? You didn't specify that. Show some code and tell us what you have done so far. Then be more specific about the above so we can give you a more precise advice.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Load all the data of the database into a list of objects.
Have a separate method in a separate class that handles the connection with the database and returns that list of objects

Then since you have that list, you can display the element of the list. Have a variable for the current item's index of the list

When the FIRST button is clicked display the list.get(0) and make that index=0
For NEXT increase the index (index++) and display the list.get(index)
For PREVIOUS decrease the index (index--) and display the list.get(index)
For LAST make the index=list.size()-1 and display the list.get(index)


Create your classes separately and test them separately. Start with the class for the database. Create your method, run it in a main method and see if it works.
Then create the GUI and try to test the buttons.
Then call your method at the gui and access its elements.

For the database you can find plenty of examples. Let us see your version.
For the gui check out some tutorials.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you tried the simplest thing? Reading the error message that you get!
It clearly says:
java.lang.ArrayIndexOutOfBoundsException

Somewhere in your code you are using an index that is too large or too small. It is like trying to access an array with an index greater than its length. Try reading the whole message until you find the first class or file that you have created(that it is yours). The message says the line where the error occurred.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

When you submit to the next page read the value of the radio button and query the database based on that number. Then display the data from the DB.

What code did you use to display the radio buttons. I assume that the value of the radio buttons are the number(id) of the account.

<input type="radio" name="radioAccountNo" value="<%=accountNum%>" />

And the above is in a for loop with the name being the same and you change only the value.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to post the entire code in order to see where are those variables defined, because if you say that:

if i use the if-else method in the driver class, then it works.

Then there must be a confusion with what object you instantiate what attributes you are using.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster
if (any expression that results to a boolean) {
  // any code
} else if (...) {
  // any code
} else {
  // any code
}

That small example means that you can call anything you want inside the if statements. And you can put that if-statement wherever you want. After all the main method is also a method so you can put your ifs inside other methods that you can call.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Sorry to barge in after it's been solved, but with the number being an integer to begin with, you could have written:

if (number<10)
   number*=10;

Also, nest your if/else; they way you wrote it: it will test all your conditions. If Number isn't < 10 it most certainly is >= than 10, so no need to test in that second if.

No that is completely wrong and you should read first the previous posts more carefully.
The idea is to convert the integer: 5 to: "05" With your way the number 5, would become 50!

Also a more simple way would be:

if(mNumber < 10) {
  m = "0" + mNumber;
}

When you concatenate numbers and Strings the conversion to String happens automatically. If you simply want to convert an int to a String then the above is not the best approach and use the method you are already using. But if you want to concatenate an int with a String then the above is simpler.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hey Rahul.......

The button you have created does not contain any external resources or does not process any requests....

I think just update the <input button....> tag line like :

<input type="submit" name="btnEnter" value="Enter Details" />

Oups. I missed that.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

@javaAddict
I stated the approach in my answer.

@apines
That's why my approach checks for the string length instead of immediately access the string at the position.

Ok. I didn't see it in so many posts. I assumed that If someone had given such suggestion it wouldn't be necessary for more posts after yours

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hasn't anyone thought of using the split method:

String s = "A- 4";
String [] tok = s.split(" ");

// tok[0]: A-
// tok[1]: 4

If you have "B 4" then again you will get an array of two elements.
Then check the length of tok[0]. If it is one then it has only the letter:
tok[0].charAt(0)

If it has length 2 then it also has a +/- :
tok[0] = "A-"
tok[0].charAt(0)
tok[0].charAt(1)


EDIT:
Or even the index of method:

String s = "A 4";
int index = s.indexOf(" ");
String letter = s.subString(0, index); // it might have A+ if the initial string has the symbol +/-
String number = s.subString(index+1, s.length);
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If you are reading the file line by line, and you are SURE that each line will have values separated by an empty String then you can use this example:

String line = "1234 HEDEPT 12-3-2009 12-03-2009 yesno yes A hello@hello.com 12 y12";

String [] tokens = line.split(" ");

// Now print the array and see what happens:
for (int i=0;i<tokens.length;i++) {
   System.out.println(i+":"+tokens[i]);
}

There is always the subString method you can use that is only when you know the the fields will have a fixed size. If the lines are like that use the split method:

1234 HEDEPT 12-3-2009 12-03-2009 yesno yes A hello@hello.com 12 y12
123 HEDEPTASD 12-3-2009 12-03-2009 yesno yes A bye@bye.com 12 y12
javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

to call another class call its main

No!! that is wrong. You don't call its main. The main is used only when you run the class, in order to start your program. If you want to call another class, call its constructor. Create a new instance and call its methods. In this case just instantiate the Frame you want to open and make it visible.

If you have two classes that extend the JFrame or even 2 JFrame instances whenever you create them and call the setVisible they are displayed. So when the button is clicked just create the frame you want to open.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

The doGet method inside witch file/class it is? Because the action in your jsp form must submit to that file.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I completely agree with you, BUT he said he was in the hurry /4hrs till deadline/. So IMHO not giving him a small piece of code would be cruel.

It doesn't matter if there are 4 hours or 4 minutes left for the deadline. In this forum we don't hand out code. We help them learn. Just posting the code is wrong and the fact that she waited until the last minute is not an excuse.

You just did all the work for her. She was lazy and you did it for her.
She learned nothing and benefited from your effort.

I tried to help her by providing advices and after she posted her code I gave more advice. But giving the code will not be fair for the rest of her classmates that actually did their own work.


And with all that code that you have been given ITmajor you should have put some effort to understand it and learn from it. But instead of trying to understand it so you can learn from it, you keep on asking for more free code.

That is the gratitude that you received yuri1969. She asked you to do more of her work.


What are you going to do at your next assignment?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Post your code using code tags. And the idea is for you to calculate the average based on the input. Not ask the user to enter it. While you get the grades, add them then divide by 10 to get the average.

Then if the grade is lower than a number and greater than another then print the letter. That will be your if statements. Map the letter grades with the numbers

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

We are not going to do it for you. And you weren't given this assignment 4 hours ago. I am sure you have been given plenty of time to study and do it. Even plenty of time to come here and ask for help.

Had you come here sooner you would have been given plenty of help and time to do it on your own. But now you will receive the same advices. It is up to you to finish it.

So:
First create a class, let's say it: Student. It will have attributes: id and mark. Create get, set methods.
Then in a main method create an array of students, loop it and read from the keyboard the id and mark of each student. Use the Scanner class and search for examples on how to use it.

I am sure that you have notes on how to create a class.

Student [] stds = new Student[10];
for loop {
  stds[i] = new Student();
  stds[i].setId(...); // read from keyboard
  stds[i].setMark(...); // read from keyboard
}

Then loop again the array, calculate the average and by the use of if statements print A or B or C or .....

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you tried searching the net for what you need. The title means nothing. You need to decide what your application will do. Not us. It is your project.

When you do ask specific questions concerning the code.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Do you have any requirements or just a title of a project?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You need to put the tag into a form and submit that form. Then use my example or another that you like and get the request.

If you don't know that input tags go inside forms that are submitted then you shouldn't be doing any of this.

You should be studying the basics of HTML and JSP. If the above is true then giving you code with that amount of knowledge will not help you.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You can try this then:

JScrollPane scrollTable = new JScrollPane(table);

And then add the scrollTable to the panel or the JFrame.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Hello Friend! I am getting File through <input type="file" name="imageFile" />, I need to use this in scriplet. I have been searching this for the last 1 hour, can u tell me how to do this? I am trying a lot, getting only for String input. I need it for File input.

And what about the link I provided? If you can't understand it then post code and ask questions or do some search on your own.

But that link has an example to help you started, of you read it carefully of course.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Yes I have used tag <input type="file" name="imageFile" /> also to get dynamic file path. But I dont know how to use that file in java.

That is what you need to search. There are examples and libraries specifically for that. What server are you using? I think that Apache already has classes and methods for getting that file, in the same way you get the request.

A very simple search at the net got me this result:
http://www.developershome.com/wap/wapUpload/wap_upload.asp?page=jsp

Check out that page (page 8) and the next.

Was it so difficult?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Can you post the whole stack trace ?

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you used what I suggested:

<input type="file" />

In order to load the image? I don't see it since you hard coded the file source name. Search the web for examples on how to load file with that attribute and what other arguments it takes.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Edit: Sorry I didn't look the code and what I wrote was not very accurate. This is the code I suggest:

public class Animal {
   public void eat() { 
      System.out.println("I eat like a generic Animal."); 
   }
 
   public static void main(String[] args) {
   }
}
 
class Fish extends Animal {
   @Override
   public void eat() { 
      System.out.println("I eat like a fish!"); 
   }

  public void eat2() { 
      super.eat();
   }
}
 
class Goldfish extends Fish {
   @Override
   public void eat() { 
      System.out.println("I eat like a goldfish!"); 
   }

   public void eat2() { 
      super.eat2();
   }
}

When GoldFish will call eat2, it will call the super eat2: Fish.eat2. Then Fish.eat2 will call the super eat: Animal.eat.

Try to copy the code and check it out. I didn't test it, but it is up to you to experiment. That is one way to learn.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Why don't you ask the person whose code you copied? It is obvious that it returns the day.

If you want a code that returns the day then write your own and post it here with questions in order to get help. You can use the java.text.SimpleDateFormat class, if you are allowed.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

If you are new in java then this task is not for you. If you had previous experience with jsp then that experience would have been acquired by studying, and you would know what you needed to do:

You need to search the net for examples on how to load files. You will use the input tag type="file" in your jsp/html code.

There are plenty of examples that you can find by searching.

After you are done loading the file, how do you want to save it? The easiest way would be to create a folder at your server and copy the files there.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

You could use your servlet to display the pagevia your PrintWriter. Just write a string of HTML head and body to it. Try it by writing some html string to the writer first, so you would at least see what would be displayed on the web.

That is absolutely wrong. Don't write html inside servlets. Even if you can do it, you shouldn't.

And if you want dynamic html, you can use this code in a jsp:

<table>

<%
for (int i=1;i<=10;i++) {
%>

  <tr>
    <td>
       <%=i%>*0 = <%=i*0%>
    </td>
    <td>
       <%=i%>*1 = <%=i*1%>
    </td>
    <td>
       <%=i%>*2 = <%=i*2%>
    </td>
    ....
  </tr>

<%
}
%>

</table>

Try executing that code as a test and see what happens. You can have the <td> tags in a for loop as well:

<%
for (int j=0;j<=10;j++) {
%>

    <td>
       <%=i%>*<%=j%> = <%=i*j%>
    </td>

<%
}
%>

Instead of having multiple <td> . Just submit the first page to a JSP and take the parameters that you need and use them to determine the upper limits of the for loops.
I don't believe that a servlet is necessary since all you do display data

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

Have you declared a method integerparseInt somewhere? The error was pretty clear.
It said it could not find symbol. Symbol: method integerparseInt. Meaning that it could not find the method integerparseInt because it doesn't exist. Try to read more carefully the errors that you get and not just expect others to read them for you. You should be able to fix those simple ones on your own.

javaAddict 900 Nearly a Senior Poster Team Colleague Featured Poster

I assume that you need to input grades for each of those: exam,project, assignemnt,....
Then based on those grades print the description:

exam: 60, Sorry you failed!
project: 81, Good Job!

For more information about the calculations ask your teacher. Also please post the full description of your project.