You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by pradeep reddy <pr...@live.com> on 2008/10/13 12:11:35 UTC
Image verification on the login portlet
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
RE: Image verification on the login portlet
Posted by pradeep reddy <pr...@live.com>.
woonsan thats great, it is working..... thanks a lot
> Date: Mon, 13 Oct 2008 09:21:26 -0700> From: woon_san@yahoo.com> Subject: RE: Image verification on the login portlet> To: jetspeed-user@portals.apache.org> > Hi Pradeep,> > I think you should put the context path like the following (if the context is /j2-admin and the jsp works as intended):> > <img src="/j2-admin/Cap_Img.jsp">> > Regards,> > Woonsan> > > --- On Mon, 10/13/08, pradeep reddy <pr...@live.com> wrote:> > > From: pradeep reddy <pr...@live.com>> > Subject: RE: Image verification on the login portlet> > To: "Jetspeed Users List" <je...@portals.apache.org>> > Date: Monday, October 13, 2008, 5:13 PM> > I am sorry here again.> > When i use a jsp name in the src attribute of the image tag> > like <img src="Cap_Img.jsp">> > In the login.jsp which is in the j2-admin application, it> > is not rendering any image at all in first place.> > > > Can anybody help me out in this one?> > > > The code in the Cap_Img.jsp is in the below mail.> > > > Regards,> > Pradeep.> > > > > > > > > From: pradeep.reddy@live.com> To:> > jetspeed-user@portals.apache.org> Subject: Image> > verification on the login portlet> Date: Mon, 13 Oct 2008> > 15:41:35 +0530> > 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> > _________________________________________________________________> > Searching for weekend getaways? Try Live.com> > http://www.live.com/?scope=video&form=MICOAL> > > > > ---------------------------------------------------------------------> To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org> For additional commands, e-mail: jetspeed-user-help@portals.apache.org>
_________________________________________________________________
Movies, sports & news! Get your daily entertainment fix, only on live.com
http://www.live.com/?scope=video&form=MICOAL
RE: Image verification on the login portlet
Posted by Woonsan Ko <wo...@yahoo.com>.
Hi Pradeep,
I think you should put the context path like the following (if the context is /j2-admin and the jsp works as intended):
<img src="/j2-admin/Cap_Img.jsp">
Regards,
Woonsan
--- On Mon, 10/13/08, pradeep reddy <pr...@live.com> wrote:
> From: pradeep reddy <pr...@live.com>
> Subject: RE: Image verification on the login portlet
> To: "Jetspeed Users List" <je...@portals.apache.org>
> Date: Monday, October 13, 2008, 5:13 PM
> I am sorry here again.
> When i use a jsp name in the src attribute of the image tag
> like <img src="Cap_Img.jsp">
> In the login.jsp which is in the j2-admin application, it
> is not rendering any image at all in first place.
>
> Can anybody help me out in this one?
>
> The code in the Cap_Img.jsp is in the below mail.
>
> Regards,
> Pradeep.
>
>
>
> > From: pradeep.reddy@live.com> To:
> jetspeed-user@portals.apache.org> Subject: Image
> verification on the login portlet> Date: Mon, 13 Oct 2008
> 15:41:35 +0530> > 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
> _________________________________________________________________
> Searching for weekend getaways? Try Live.com
> http://www.live.com/?scope=video&form=MICOAL
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-user-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-user-help@portals.apache.org
RE: Image verification on the login portlet
Posted by pradeep reddy <pr...@live.com>.
I am sorry here again.
When i use a jsp name in the src attribute of the image tag like <img src="Cap_Img.jsp">
In the login.jsp which is in the j2-admin application, it is not rendering any image at all in first place.
Can anybody help me out in this one?
The code in the Cap_Img.jsp is in the below mail.
Regards,
Pradeep.
> From: pradeep.reddy@live.com> To: jetspeed-user@portals.apache.org> Subject: Image verification on the login portlet> Date: Mon, 13 Oct 2008 15:41:35 +0530> > 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
_________________________________________________________________
Searching for weekend getaways? Try Live.com
http://www.live.com/?scope=video&form=MICOAL