Servlet

Reading initialization parameters from ServletContext

Let’s understand the need of initialization parameters: In the practical example of RequestDispatcher, we used DividerServlet & HandlerServlet. Lets have another look at the them. DividerServlet code snippet: package com.techmentro.learningpad; … public class DividerServlet extends HttpServlet { public void doPost(HttpServletRequest request,HttpServletResponse response) { try { … //RequestDispatcher is created for index.html RequestDispatcher rd=request.getRequestDispatcher("index.html"); … }catch(Exception […]



Practical example of inter application forwarding

In this practical example of inter application forwarding, we will create App1 and App2 applications which were discussed in the last post. Here we go, first one is the single line home page (index.html) of App1 : S1 servlet of App1 Second, S1 servlet of App1 : package com.techmentro.learningpad; import javax.servlet.http.*; import javax.servlet.*; import java.io.*; […]