This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!

Udayaditya Barua

Greenhorn
+ Follow
since Dec 05, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
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.

Bill



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 ]
9 years ago
hi,
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??
9 years ago

Originally posted by David McHugh:
[QB

[/QB]



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
@shekhar
thanks

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