Using Spring, mapping to root in web.xml, static resources aren’t found

The problem is that requests for the static content go to the dispatcherServlet, because it’s mapped as <url-pattern>/</url-pattern>. It’s a very common problem in applications with “RESTful” URLs (that is, without any prefix in the DispatcherServlet mapping). There are several possible ways to solve this problem: Since Spring 3.x the preferred way to access static … Read more

How to integrate Struts 2 with Tiles 3

The solution is to add the required dependencies, load tiles with an appropriate listener and create a custom result type. Fortunately these steps are quite easy, once done you can follow normal tiles 2 examples for a how to define templates. 1) Dependencies (start with basic struts project but in this example I’ll use conventions … Read more

Can I serve JSPs from inside a JAR in lib, or is there a workaround?

Servlet 3.0 which Tomcat 7 supports includes the ability to package jsps into a jar. You need to: place your jsps in META-INF/resources directory of your jar optionally include a web-fragment.xml in the META-INF directory of your jar place the jar in WEB-INF/lib directory of your war You should then be able to reference your … Read more

tech