aspose file tools
The moose likes Servlets and the fly likes JSP Request Object Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "JSP Request Object" Watch "JSP Request Object" New topic
Author

JSP Request Object

Gary Guion
Greenhorn

Joined: Jun 21, 2001
Posts: 23
When I call request.getParameter to get the value of a field from the calling page, if that field was blank then is the string returned "" (empty)? I am using a conditional like
if(name != "" && email != "") and even if I leave the fields blank it still enters the if and never sees the else. Why?
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1506
I always check for null and the length of the returned parameter. What is returned (null or "") depends on the browser.
EX:
if( (email != null) && (email.length() != 0) )

Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Gary Guion
Greenhorn

Joined: Jun 21, 2001
Posts: 23
I am using the .equals method and it is working now.
Thanks
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JSP Request Object
 
Similar Threads
Empty text Field Validation in JSF data Table
focusControl has no properties
Exam 7, Q18 Dan Chisholm
Displaying blank spaces between two words
don't use any IDE for SCJP