Udayaditya Barua

+ Follow
since Dec 05, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Udayaditya Barua

Originally posted by William Brogden:
I see code like:

but it looks like correctScoreArray is an instance variable and is thus used for all requests. It is always there and does not need to be put in the user's session.

I see local variable creation like:

but I dont understand what you are trying to do with it.


getCorrectScoreSessVar is the variable used to collect the value of the session. I am incrementing that and storing the new value in the session. I've removed the correctScoreArray usage in the code. Just trying to implement multiple counters based on the option(if else). Can you tell me a better way to do it?
[ December 21, 2008: Message edited by: Udayaditya Barua ]
10 years ago
I have a website which is a maths tutorial. In short, there are addition,subtraction,multiply and division. One servlet generates a problem and sends it to the client.Now, when the user enters the answer another ajax request is sent to a different servlet. This servlet, maintains the score for CORRECT answers and WRONG answers in sessions. I though it wud be better to create an array for CORRECT and WRONG since, there will be too many variables each for correct/wrong addition,subtraction etc.
I have 2 arrays:
I am storing these arrays in sessions. heres the rest of the code..

Similarly for subtraction,mul,div. The problem is, the values dont get added!. I WANT them to be replaced with the new ADDED values. Like a counter.. Can anyone help me out??
10 years ago

Originally posted by David McHugh:


Correct me if i m wrong, if this is a windows system, filename path should have backslashes instead of forward.So
String filename = "C:\Java\jakarta-tomcat-5.0.28\webapps\text.txt";
10 years ago
Same as above except you can also try

10 years ago

Ok, sry for the delay.. Managed to solve the problem after a lot of searching... Had to write a 'return' after the forward command..
About the switch case executing every statement, doesnt writing a "break" solve that?..Just asking..
10 years ago
Hi, im kind of new to servlets. i have a servlet which accepts data from a HTML form. Basically 2 numbers, according to the option chosen, their addition,multiply etc. User enters the answer, servlet checks whether it was correct or not. If wrong, shows solution.
processRequest() is the function which is called by doPost. It calls processAnswer() which basically does the forwarding of the page according to the answer.
Heres processRequest

WHICH CALLS processAnswer()

Really need help here..I tried adding a "return" in processRequest, didnt help.
10 years ago