PDA

View Full Version : No mapping error


Rachel_K
Dec 5th, 2007, 03:29 PM
What does this error mean?

2007-12-05 15:21:47,725 WARN [org.springframework.web.servlet.PageNotFound] - No mapping for [/ReportingSuite/report/dashboard/viewApplicationProperties&levelOne=FMS-NEBU&levelTwo=NORTH%20NEW%20ENGLAND%20REGION&levelThree=MASS/HAMPSHIRE%20AREA&perspectiveId=3&changedLevel=levelThree] in DispatcherServlet with name 'report'

I strongly suspect the slash in MASS/HAMPSHIRE has something to do with the problem that I am having because if an item with out a slash is passed. The code works properly. What do you suggest that I do?

pmularien
Dec 5th, 2007, 04:03 PM
How are you generating that link? Request parameters in URLs should be URL encoded to avoid issues like this (in this example / should be encoded as %2F).

Rachel_K
Dec 5th, 2007, 04:06 PM
I am passing it in as a string. Is there a way to have Spring convert this to the correct character or do I need to write code to do the conversion?

pmularien
Dec 5th, 2007, 04:16 PM
What are you "passing it in" to? A redirect view? Are you printing this on your JSP?

Rachel_K
Dec 5th, 2007, 04:18 PM
A redirect view.

pmularien
Dec 5th, 2007, 04:35 PM
If you're using a RedirectView properly (where properly = including a Map with all the parameters you're interested in), Spring should URL encode the parameters for you, e.g.:

Map model = new HashMap();
model.put("level Three","MASS/HAMPSHIRE AREA");
... etc.
return new ModelAndView(new RedirectView("/ReportingSuite/report/dashboard/viewApplicationProperties"),model);

Does this look like what you're doing? Or are you assembling the query string yourself?

Rachel_K
Dec 5th, 2007, 04:59 PM
I am building the query string myself. That appears to be the problem then. If I do what you suggest, will the parameters be attached onto the end of the URL?

I am going to give it the old college try and see if that goes.

pmularien
Dec 6th, 2007, 10:55 AM
I am building the query string myself. That appears to be the problem then. If I do what you suggest, will the parameters be attached onto the end of the URL?

I am going to give it the old college try and see if that goes.
Yes, the default behavior of RedirectView is to serialize all the name/value pairs in the associated Model to query string parameters (with appropriate URL encoding). It's actually very convenient once you get used to using it.