The Ccode looks like this.
Th problem is when I execute index.jsp even if i don't enter the name in the index.jsp, instead of displaying handle.jsp it displayes hello.jsp. But the EL in hello.jsp displayes nothing.
And another doubt, what do they mean by <jsp:forword> starts with clear response buffer.
Please help me understand the code and why so.
It is not working as explained in the book that's the problem.
And Vishwanath seems to be right. Empty string is not a null. Of I call request.getParameter("userName").length() it is giving answer as zero instead of throwing NullPointerException
Vishwanath Murthi wrote:I guess the userName parameter value would be a "" which is not the same as null
yes this is the same thing i thought of. because even someone doesn't enter data into a form field, all the parameters will be there on the request. so that means if i asked the value of userName(in this case) it should return me a empty string not a null value.
Anil Deshpande wrote:Don't you think, it is wrong. When I am not entering anything in the text feild, I expect it to be a null value. not a empty String with length=0.
I will never be sure whether to check for empty string or handle NullPointerException.
Well if you do the same(putting a text field and call getText()) in swing you will get a empty string not a null value. So I think some what same applies here. Anyway even this is not the same I think it should work like I said.