title: How to display a default image when image source is a servlet?
body: <p>In my JSP/ Servlet setup, for displaying user profile images I am directing the <code>img</code> tag to get the image from servlet by specifying servlet URL in <code>src</code> tag and then returning image in response from servlet. </p>
  
  <p>Sevlet does below things upon receiving an image request,</p>
  
  <ol>
  <li>It gets the image from database in <code>BLOB</code> format</li>
  <li>Prepares image from the <code>byte</code>[] and </li>
  <li>returns the image in <code>response</code> object with appropriate headers.</li>
  </ol>
  
  <p>My problem is since Signup page doesn't has image upload option so new users don't have their image in database i.e. so the <code>BLOB</code> is <code>NULL</code>. <strong>How can I display a default image for all such users ?</strong></p>
  
  <p><strong>EDIT</strong>
  Based on comments received I just wanted to note that. I am aware of the solutions where we set the default value either in database (while creating the user) or return the default image array when there is NULL in database. <strong>I am already using the later case.</strong> By this question I just wanted to discuss about <strong>any other possible solutions</strong>.</p>