title: unable to load captcha.jsp in my img tag for my registration form
body: <p>I am implementing captcha for my my registration form. When my page loads, i do not know why my captcha does not loads(shows).</p>
  
  <p>I am showing my captch using img tag:->   <code>&lt;img src="captcha.jsp"/&gt;</code>.
  But same captcha when i acceess it through facebox then it is appearing. I do know why it is happening like this.</p>
  
  <p>Please help me if you can.</p>
  
  <p>-Thanks</p>
  
  <h2>index.jsp</h2>
  
  <pre><code> &lt;html:form action="/addUserAction?method=addUser" method="post" onsubmit="return validateAddUserForm(this);"&gt;
          &lt;html:javascript formName="addUserForm"&gt;&lt;/html:javascript&gt;
          &lt;table border="0" width="100%" align="center" height="100%"&gt;
  
  
              &lt;tr&gt;
                  &lt;td align="center" bgcolor="#d0d67f" colspan="2" &gt;&lt;font size="5" face="Broadway" color="#4d4207"&gt;Registration Form&lt;/font&gt;&amp;nbsp;&amp;nbsp;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="center" colspan="2"&gt;&lt;div id="ashutosh" style="background:#ffebe8;border:0px solid #dd3c10;background-position: top"&gt; &lt;/div&gt; &lt;div id="ansuman"  &gt; &lt;/div&gt;   &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;&lt;img alt=""  src="images/validation/backRequiredGray.gif"&gt;&lt;font size="3" face="Broadway" color="#4d4207"&gt;Name&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;html:text tabindex="3" style="height:27px;font-size:16pt;"  property="name" maxlength="240"&gt;&lt;/html:text&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;&lt;img alt=""  src="images/validation/backRequiredGray.gif"&gt;&lt;font size="3" face="Broadway" color="#4d4207"&gt;Email&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;
                  &lt;td&gt;
                      &lt;html:text tabindex="4" style="height:27px;font-size:16pt;" onkeyup="getEmailCheckResult(this.value);"   property="email"&gt;&lt;/html:text&gt;
  
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td align="right"&gt;&lt;font size="3" face="Broadway" color="#4d4207"&gt;Phone Number&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;html:text tabindex="5" style="height:27px;font-size:16pt;" maxlength="15"  onkeypress="return ValidateNum(this,event)" property="contactNumber"&gt;&lt;/html:text&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
  
  
              &lt;tr&gt;
                  &lt;td height="30" align="right" &gt;&lt;font size="3" face="Broadway" color="#4d4207"&gt;Code&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;
                  &lt;td height="30" align="left"&gt;&lt;img alt=""  src="captcha.jsp" width="208"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td height="30" align="right" valign=""&gt;&lt;img src="images/validation/backRequiredGray.gif"&gt;&lt;font size="3" face="Broadway" color="#4d4207"&gt;Enter Code&amp;nbsp;&amp;nbsp;&lt;/font&gt;&lt;/td&gt;
                  &lt;td height="30" align="left" &gt;
                      &lt;html:text tabindex="7" property="code"  style="height:27px;font-size:16pt;"  onkeyup="getCapchaCheckResult(this.value);"   size="16" maxlength="13"&gt;&lt;/html:text&gt;
                   &lt;div id="ansuman"&gt; &lt;/div&gt;
                  &lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td height="30" align="center" valign="middle" colspan="2"&gt;&lt;img alt=""  &gt;&lt;font color="#4d4207"&gt;By clicking Sign Up, you agree and understand  our&lt;/font&gt; &lt;a href="tc.do" target="blank"&gt;&lt;font color="#4d4207"&gt;Terms &amp; Conditions.&lt;/font&gt;&lt;/a&gt; &lt;/td&gt;
              &lt;/tr&gt;
  
              &lt;tr&gt;
                  &lt;td height="30" align="right" valign="middle" colspan="2"&gt;&lt;img src="images/validation/backRequiredGray.gif"&gt; Fields Required&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td colspan="2" align="center" &gt;&lt;input type="submit" style="height:37px;font-size:16pt;color:#4d4207;" value="Sign Up"&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td height="30" align="center" valign="middle" colspan="2" bgcolor="#d0d67f"&gt;&lt;font color="#4d4207"&gt;Please Note: The Password will be emailed to the mail Id provided.&lt;/font&gt; &lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/html:form&gt;
  </code></pre>
  
  <h2>captcha.jsp</h2>
  
  <pre><code>&lt;%--
          Document   : captcha
          Created on : 23 Jan, 2012, 2:23:50 PM
          Author     : Ashutosh
      --%&gt;
  
  
      &lt;%@ page import="java.util.*, java.io.*,java.awt.*,java.awt.image.*,javax.imageio.*,java.awt.geom.*"%&gt;
      &lt;%
       response.setContentType("image/jpg");
        /* Define number characters contains the captcha image, declare global */
        int iTotalChars= 6;
  
        /* Size image iHeight and iWidth, declare globl */
        int iHeight=40;
        int iWidth=150;
  
        /* font style */
        Font fntStyle1 = new Font("Arial", Font.BOLD, 30);
        Font fntStyle2 = new Font("Verdana", Font.BOLD, 20);
  
        /* Possible random characters in the image */
        Random randChars = new Random();
        String sImageCode = (Long.toString(Math.abs(randChars.nextLong()), 36)).substring(0,iTotalChars);
  
        /* BufferedImage is used to create a create new image*/
        /* TYPE_INT_RGB - does not support transpatency, TYPE_INT_ARGB - support transpatency*/
        BufferedImage biImage = new BufferedImage(iWidth, iHeight, BufferedImage.TYPE_INT_RGB);
        Graphics2D g2dImage = (Graphics2D) biImage.getGraphics();
  
        // Draw background rectangle and noisey filled round rectangles
        int iCircle = 15;
        //g2dImage.fillRect(0, 0, iWidth, iHeight);
        for ( int i = 0; i &lt; iCircle; i++ )
        {
          g2dImage.setColor(new Color(randChars.nextInt(255),randChars.nextInt(255),randChars.nextInt(255)));
          int iRadius = (int) (Math.random() * iHeight / 2.0);
          int iX = (int) (Math.random() * iWidth - iRadius);
          int iY = (int) (Math.random() * iHeight - iRadius);
          //g2dImage.fillRoundRect(iX, iY, iRadius * 2, iRadius * 2,100,100);
        }
        g2dImage.setFont(fntStyle1);
        for ( int i = 0; i &lt; iTotalChars; i++ )
        {
          g2dImage.setColor(new Color(randChars.nextInt(255),randChars.nextInt(255),randChars.nextInt(255)));
          if (i%2==0)
            g2dImage.drawString(sImageCode.substring(i,i+1),25*i,24);
          else
            g2dImage.drawString(sImageCode.substring(i,i+1),25*i,35);
        }
  
        /* create jpeg image and display on the screen*/
        OutputStream osImage = response.getOutputStream();
        ImageIO.write(biImage, "jpeg", osImage);
        //osImage.close();
  
        /* Dispose function is used destory an image object */
        g2dImage.dispose();
  
        session.setAttribute("dns_security_code", sImageCode);
        //System.out.println("Captcha Page :"+session.getAttribute("dns_security_code"));
  
  
      %&gt;
  </code></pre>