Skip to main content

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:
header
hello :: springapp

greetings, [current time]
products
[sample-products 1, 2 , 3]
but time , products not printing.

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):

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);
so either modelmap null, or .get("now") returns null. confirm null throwing in assertion before line 25.

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

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support