Hi how can I replace "null" from being displayed with an empty string in a textbox on the JSPs ..depending on textbox data availability..
I tried the code

<% String phone=userInfoObj..getPhoneno();
if(phone==null||phone.equalsIgnoreCase("null"))
phone=" ";
%>		
<td >
<input type="text" name="phoneno" class="txtBox" value="<%=phone %>"></td>

but still it displays null


can you suggest by using java or javascript?

<% String phone=userInfoObj..getPhoneno();
if(phone==null||phone.equalsIgnoreCase("null"))
phone=" ";
%>		
<td >
<input type="text" name="phoneno" class="txtBox" value="<%=phone %>"></td>

Recommended Answers

All 2 Replies

>can you suggest by using java or javascript?

You can't use JavaScript code.

<% 
String phone=userInfoObj.getPhoneno();
if(phone==null)
   phone="";
%>

well it got solved using javascript:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.