I am trying to run the Head First Servlets and JSP chapter's 3 beer example like so many others in here.
I have done every step successfully till the time i had to run a .jsp for the first time.
The result.jsp code is:
but when i try to run it i get this from tomcat (and some other stuff):
I read all the topics about others having problem with this exercise and none had a similar one.
If i change the result.jsp file to this:
everything runs smoothly and the message i printed properly.
for the record, the class with the setAttribute method is this:
Is there a problem with request.setAttribute("styles", result) in the .class file; ? If there was one, why tomcat sais the problem is in the Iterator it = styles.iterator();iterator line in the .jsp file?
Anyone got any ideas?
Thanks in advance.
- X 2
In your jsp code you are getting attribute value for 'style' : List styles = (List)request.getAttribute("style"); at line 9
but in your servlet code you set the value for 'styles' :request.setAttribute("styles", result); at line 16
that cause the exception...
replace your jsp code at line 9 with List styles = (List)request.getAttribute("styles");
Nikolaos Plastiras wrote:OH MY GOD, i spent 3 hours reading every others' problems, documentations about tomcat, jsp, jstl and jdk just because i was too tired at 4am to check for the most stupidest errors. I feel so embarrassed... Thanks for the help. Next time, i'll get a good night sleep.
don't be embarressed, it is only after this first one you learn to check and double check those pesky strings,
makes you wish there was some way you could make constants between the jsp and servlet for that type of stuff.