I got the
servlet below to work when the servlet wrote out some html using out.println(). The html displayed correctly in my browser. Then I commented out the out.println() lines, and I tried to attach the info to the request object and then forward the request object to a
jsp. However, now I get no output in my browser--just a blank page.
webapps/Beer-v1/result.jsp:
I tried various casts on the value returned by request.getAttribute(), but nothing worked.
BeerExpert.java:
Hmmm...after some more
testing, I think the problem is because I'm using List<
String> instead of List. When I use List, my browser displays the output correctly, but I get some "Notes" when I compile the code:
Note: src/com/example/model/BeerExpert.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Are servlets unable to handle generics?
$ java -version
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-113)
Java HotSpot(TM) Client VM (build 1.5.0_06-68, mixed mode, sharing)
apache-tomcat-6.0.13
Now both versions of my servlet are working. This is the cast that works:
[ May 29, 2008: Message edited by: sven studde ]
[ May 29, 2008: Message edited by: sven studde ]
[ May 29, 2008: Message edited by: sven studde ]