Spring 2 MVC and ResourceBundleViewResolver problem

This one took some time to figure out – it is one of those problems that are obvious after you know the solution but hard to see beforehand.

I had the ResourceBundleViewResolver configured with Tiles 2, like this:







and the view.properties was:

parent-view.(class)=org.springframework.web.servlet.view.JstlView
parent-view.(abstract)=true

about.url=/WEB-INF/jsp/about.jsp
form.url=/WEB-INF/jsp/form.jsp
list.url=/WEB-INF/jsp/list.jsp

It kept givin exception saying that /WEB-INF/jsp/list.jsp does not exist. Which it did. I tried couple of things, no result.

The problem was in trailing space AFTER list.jsp, therefore the path to JSP file searched for was “/WEB-INF/jsp/list.jsp “, not “/WEB-INF/jsp/list.jsp”.

Not sure if this is bug or feature – but removing trailing spaces should really be a sensible thing to do. As I found afterwards, the problem exists since 2005 – see this and this.

Advertisements
Explore posts in the same categories: Java, springframework

2 Comments on “Spring 2 MVC and ResourceBundleViewResolver problem”

  1. Eswar Says:

    Nice information.

  2. Federica Says:

    T-H-A-N-K Y-O-U!!!! I get this error and I didn’t know what to do, I’ve been saved by your post.

    Bug or feature? I would say criminal minds, but now I’m still angry…


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: