Im new to spring so if im going at this the wrong way, please say so!
I have a simple AbstractCommandController, with a command object NewsListCommand, that takes an Integer page with setPage, getPage.
Now ive spent some time to get this thing to compile and wire properly, and then i stumble on this error.
The controller is mapped to /index via <bean name="/index" ...>, it works fine if I call it via /index?page=1. But if the page parameter is missing, the whole thing crashes...
So am i going at this the wrong way? Is there a way to tell spring that the parameter might not be there (theres always that possiblity, why is it crashing anyhow?).Code:org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.NullPointerException org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:583) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803) root cause java.lang.NullPointerException my.test.app.MainController.handle(Unknown Source) org.springframework.web.servlet.mvc.AbstractCommandController.handleRequestInternal(AbstractCommandController.java:84) org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153) org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:875) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:809) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) javax.servlet.http.HttpServlet.service(HttpServlet.java:690) javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
Is there a simpler way of doing this possibly? I just need to get a (possible) param from the request, preferrably using spring to do it, if i wanted to use plain servlets, i'd do so
Any input appreciated.



Reply With Quote