I have a very interesting problem. Let me post some code first and then I will explain.
Here is the problem. In the jsp page, reqest.getAttribute( "invalidLogin" ) is always null. I know the logic is going through that path because the url is set properly and the log is being hit. Does anyone have any ideas on this?
Here is the problem. In the jsp page, reqest.getAttribute( "invalidLogin" ) is always null. I know the logic is going through that path because the url is set properly and the log is being hit. Does anyone have any ideas on this?
You can get arround this by using the RequestDispatchers forward() method. That way the current request object is forwarded and the requierd attribute is accessible on the forwarded page.
That's because the forward(req, res) method of RequestDispatcher takes the request and the response of the current HTTP request to the JSP. It is like forwarding the same Http request. On the other hand, sendRedirect(urlStr) actually sends a completely new Http request to the server (to the new URL, the JSP in this case) and it abandons all parameters in the current HttpServletRequest object. So, no wonder, you get the null value for the parameter in the JSP. There is no way you can pass the current request parameters to the redirected URL, unless you put them in the session. But that's a lil clumsy way to do it ;-) Pritam
Matthew Phillips
Ranch Hand
Joined: Mar 09, 2001
Posts: 2676
posted
0
Thanks for the info. I am really learning a lot on this project and from all of you.