Hello all,
 
i am some where at the end of completing the portal demo project with the help 
of the members. I need to use the image verification on the portal login page. 
i am using the default login but added the <img tag and a jsp to draw the 
image.My plan is to add a my own login proxy servlet to validate the form. the 
image tag is as bellow <td>  <img src="Cap_Img.jsp"></td> the Cap_Img.jsp is in 
the same location as login.jsp. The problem is, image is coming up properly, 
but when login failures, then the image tag is not showing any image.is 
something that changes when redirecting to the same page on login failures that 
causes img tag not to find the jsp location?
please help me in this regard.
Content of the Cap_Img.jsp is as below.  <%@ page import="java.io.*" %><%@ page 
import="java.awt.*"%><%@ page import="java.awt.image.*"%><%@ page 
import="javax.imageio.ImageIO"%><%@ page import="java.util.*"%><%int 
width=75;int height=35;Random rdm=new Random();int rl=rdm.nextInt();String 
hash1 = Integer.toHexString(rl);String capstr=hash1.substring(0,5); 
session.setAttribute("key",capstr);Color background = new 
Color(204,204,204);Color fbl = new Color(0,100,0);Font fnt=new 
Font("SansSerif",1,17);BufferedImage cpimg =new 
BufferedImage(width,height,BufferedImage.TYPE_INT_RGB);Graphics g = 
cpimg.createGraphics();g.setColor(background);g.fillRect(0,0,width,height);g.setColor(fbl);g.setFont(fnt);g.drawString(capstr,10,25);g.setColor(background);g.drawLine(10,17,80,17);g.drawLine(10,22,80,22);response.setContentType("image/jpeg");OutputStream
 strm = 
response.getOutputStream();ImageIO.write(cpimg,"jpeg",strm);strm.close();%>  
Thanks & Regards,Pradeep.      
_________________________________________________________________
Want to explore the world? Visit MSN Travel for the best deals.
http://in.msn.com/coxandkings

Reply via email to