4

I have some JSP views packaged inside a jar which I have on the Spring MVC web application's classpath. How do I set up a view resolver in the application's Spring XML file to resolve a view name to one of those classpath resources?

Martin Dow
  • 5,273
  • 4
  • 30
  • 43
  • Take a look at [this answer](http://stackoverflow.com/a/11063065/225448) on using JEE feature called web fragments to package JSPs in JAR files. – Zoran Regvart Nov 14 '15 at 15:48

1 Answers1

1

The JAR file structure might matter. §10.5 of Java Servlet 3.0 Spec says:

...For example, for a Web application with the context path /catalog in a Web container, the index.html file at the base of the Web application hierarchy or in a JAR file inside WEB-INF/lib that includes the index.html under META-INF/resources directory can be served to satisfy a request from /catalog/index.html...

Maybe try serving your JSP in that manner. If it works then all you need is just a simple Spring InternalResourceViewResolver configured with the right prefix/suffix.

gerrytan
  • 40,313
  • 9
  • 84
  • 99