Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Question: How can I prevent the word “null” from appearing in my HTML input text fields when I populate them with a resultset that has null values?
Answer: You could make a simple wrapper function, like

<%!

String blanknull(String s) {

return (s == null) ? ”” : s;

}

%>

then use it inside your JSP form, like

<input type=”text” name=”lastName” value=”<%=blanknull(lastName)% >” >
Is it helpful? Yes No

Most helpful rated by users:

©2025 WithoutBook