Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_jsp thread: Problem in Receiving parameters from Servelt


Message #1 by "Trupti Mehta" <terry_513@r...> on Fri, 11 May 2001 12:02:07
Hi, 


  I have 3 files 2- jsp & 1 - servlet. For the first time, from first JSP, 
I pass parameters to second JSP via jsp:forward. From second Jsp the 
control goes to servlet for checking and the servlet again passes all 
parameters & forwards the control to second jsp via RequestDispatcher. I 
have 5 parameters namely nm1, nm2, ret, PageOwner & msg to pass. Second 
jsp receives just nm1 & nm2 for other 3 parameters it receives null. I 
tried passing static & dynamic values but no difference. I also tried 
moving the stmt's up & down but no success. Why does this happen? Why the 
second jsp doesn't receive other 3 parameters when called by servlet & 
workes when passed by first jsp. Is their any limit for RequestDispatcher 
to pass the number of parameters. My code for RequestDispatcher in servlet 
is :

RequestDispatcher rd = getServletContext().getRequestDispatcher(url);
req.setAttribute("returnval", ret); 
req.setAttribute("PageOwner",owner);
req.setAttribute("message", message);
req.setAttribute("playerName1",nm1 );
req.setAttribute("playerName2",nm2 );
System.out.println("\t\t\tTwoPlayer.java JUST BFR FORWARD  \t  Name1 = " + 
nm1 + "Name2 = " + nm2 + "Game ID :"+gid + " loc = " +  loc+ "Moved 
By :: "+owner+"Message ::=="+message+"Value : "+ ret);
rd.forward(req, res);

S.O.P. displays proper results. No exception is thrown. 

While the code for receiving the parameters in second jsp is :-

nm1 = request.getParameter("playerName1");
nm2 = request.getParameter("playerName2");
ret = request.getParameter("returnval");
owner = request.getParameter("PageOwner");
msg = request.getParameter("message");

Please focus some light on my problem. Write me at terry_513@r...

Thanks in advance

Trupti

  Return to Index