CustomTag to generate and tags with absolute path

Generally we write our javascript and css styles in separate file and include them in JSPs using <script> and <style> tags. To include those resource we can use either relative URL or absolute URL. If you use absolute URL you need to include the context root name which is not a good practice. Later if you want to change the context root name you need to update in several places. If you use relative URL you may need to prefix the path with ../ or ../../ depending on your current URL which tedious process. To get rid of this problem

Continue reading »

When to use RequestDispatcher.forward() and response.sendRedirect()?

Many people know about how RequestDispatcher.forward() and response.sendRedirect() works. RequestDispatcher.forward() is generally called Server side redirection and is used to forward to a resource within the same application. That resource could be a JSP or another Servlet. response.sendRedirect() is generally called as Client side redirection as it issues a new request from the browser. This method is used to redirect to another resource within the same application or to the resource in some other application running in the same web container or can redirect to any other resource running in someother web container. There is one more important thing to

Continue reading »