Thread: Getting to know Spring MVC using Netbeans 7
i'm trying learn spring mvc using netbeans 7 ide , following this tutorial.
have had quite bit of trouble following tutorial able figure out through trial-and-error , dear-old google, @ moment stuck once more , cannot seem find solution.
application suppose return following:
but time , products not printing.header
hello :: springapp
greetings, [current time]
products
[sample-products 1, 2 , 3]
when run controller-test nullpointerexception (please see attachment: nullpointerexception.jpg). problem have no idea how find point nullpointerexception occurs. have never before used these test-files, , don't know how make use of them.
i'm attaching "test" , "src" directories willing @ code: files.zip.
always, appreciated.
were aware tutorial out of date? showing spring 2.5, whereas current production version 3.0.5. spring mvc changed lot spring 2.5.x spring 3.0.x. version 3.0.x released december 2009.
having said (and possibly deflated slightly), null pointer exception appears on line 25 of inventorycontrollertest.java (the 1 i've put in red):
so either modelmap null, or .get("now") returns null. confirm null throwing in assertion before line 25.code:inventorycontroller controller = new inventorycontroller(); controller.setproductmanager(new simpleproductmanager()); modelandview modelandview = controller.handlerequest(null, null); assertequals("hello", modelandview.getviewname()); assertnotnull(modelandview.getmodel()); map modelmap = (map) modelandview.getmodel().get("model"); string nowvalue = modelmap.get("now").tostring(); assertnotnull(nowvalue);
looked @ controller , think see problem is. don't worry, won't spoil. have @ controller reference , see if can see problem:
http://static.springsource.org/sprin...elandview.html
Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk Getting to know Spring MVC using Netbeans 7
Ubuntu
Comments
Post a Comment