JSP BasicsBeginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.
You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
I can not get the quizhandler.jsp to work as described in the book.
It always gives the same result no matter what combination of choices I make when taking the quiz. I believe the problem is using !=(not equals) with a String. Since a string is really an abject it looks like it is trying to compare the object to the literal. I need to compare the contents of the String object to the literal. Please Help. I even tried to use the String.equal but still get crazy results.
Here is the code that does not work as the book describes.
Thanks for the reply and your interest in helping me.
I posted the code for you to look at.
and included it here as well.
The if (answer1 != "even") fires if answer = "even" or "odd".
I displayed the value of answer* and whether it displayed even or odd the if statements fire causeing the bPassed variable to be false.
This really doesn't make sense to me.
Sorry, I didn't make my intentions clear enough. It was the code for Quiz.jsp that I wanted; as I need to see how you are setting the value for 'answer1'. Also, out of interest what version of Tomcat are you running?
I've just successfully ran the Quiz.jsp application using Tomcat 3.2.1. I used the source from the download, so if all else fails you could always try that.