Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript if else statement

Status
Not open for further replies.

chaddu1256

IS-IT--Management
Jan 13, 2003
28
0
0
US
<%
//to test for null values
String va5 = "";
if (request.getAttribute("meterNo").toString().equals("00000000")){
va5 = "&nbsp;";
}
else{
va5 = request.getAttribute("meterNo").toString();
}
%>

This is the statemenet I have at the moment. Basically there is a database entry that is either going to have a random 8 number digit, or all 0's. Right now if the database entry is all 0's then a blank space is used, Otherwise the actual 8 digit number is used. Found out today that there is another value that can be in the database and that is "null". I need to modify this statement to basically say if the request.getAttribute(meterno) is either 00000000 or null then use a blank space. Can anyone help me modify this statement to include the check for "null"
 
first off, you're in the wrong forum...you need the jsp forum695

but i'll show you anyway:

Code:
<%
//to test for null values
String va5 = "";
if (request.getAttribute("meterNo") == null
  || request.getAttribute("meterNo").toString().equals("00000000")){
  va5 = "&nbsp;";
}
else{
  va5 = request.getAttribute("meterNo").toString();
}
%>

=========================================================
-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top