The Generic DAO pattern in Java with Spring 3 and JPA 2.0
One thing that annoys me the most is code duplication. The DAO layer is the perfect candidate for this kind of situation. Often, developers forget about OOP, polymorphism and design patterns and just...
View ArticleHow to inject Spring beans into Servlets
This can be achieved in 3 simple steps: 1. Implement HttpRequestHandler First of all your servlet class must implement the org.springframework.web.HttpRequestHandlerinterface and provide an...
View ArticleHow to increase Tomcat heap size in Eclipse
If you get a lot of java.lang.OutOfMemoryErrors while running your web application on Tomcat from Eclipse, it means that you should increase the heap size of your tomcat instance. To do this, follow...
View ArticleHow to display images from the database in your jsp pages – the easy way
The easiest and elegant way to read images from the database and display them in the UI is through a servlet that handles the image processing for you. I’ll present below a sample that displays a user...
View ArticleHaving JAXB1 and JAXB2 in the same classpath
If you just add JAXB1 and JAXB2 jars into the same classpath you may end up with the following exception: You are trying to run JAXB 2.0 runtime but you have old JAXB 1.0 runtime earlier in the...
View Article