Wrox Home  
Search P2P Archive for: Go

  Return to Index  

servlets thread: Re: servlets digest: August 31, 2001


Message #1 by "Balachandar J" <zenithbala@h...> on Sat, 01 Sep 2001 11:03:48 +0530
but what you've done is added attributes to the request and then you are
retrieving parameters from your that request. You should either add
parameters to the request leave the second servlet unchanged or change the
code in the first servlet to:

 public class DispatchTest extends HttpServlet  {
 
 	public void doPost(HttpServletRequest req, HttpServletResponse res)
throws
              IOException, ServletException {
 		doGet(req,res);
 	}
 
 	public void doGet(HttpServletRequest req, 
 HttpServletResponse res) throws
 IOException, ServletException {
 
 		RequestDispatcher dispatcher 
 getServletContext().getRequestDispatcher("ReceiverTest");
 		String a = "";
 		a = req.getParameter("name");
 
 		res.setContentType("text/html");
 
 		if(a.equalsIgnoreCase("bala")) {
 
 			if(dispatcher != null) {
 				req.setParameter("age","25");
 				req.setParameter("edu","UG");
 				dispatcher.forward(req, res);

etc etc

  Return to Index