p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   J2EE (http://p2p.wrox.com/forumdisplay.php?f=94)
-   -   JSP string find characters (http://p2p.wrox.com/showthread.php?t=21653)

ndanger November 23rd, 2004 07:05 PM

JSP string find characters
I have a JSP login form that creates a session after a successful login.
I want to make sure that the session is ended when a user either closes their browser, or leaves my site. (if they bookmark the site I want to force a login even if the session hasn't timed out)

The way that I want to do this is by looking at the referring page:
<%request.getHeader("referer");%> and comparing it to my Web URL www.mySite.com/index.jsp.

All that I want to find out is that the 'www.mySite.com' exists in the 'request.getHeader("referer");'

I have seen the command 'FindNoCase(substring, string [, start ])' as a Cold Fusion function, but I can't find anything in JSP that does the same thing.

Any help would be greatly appreciated


yuji_chen November 23rd, 2004 09:26 PM

  Your can use the method provide in the string object "indexOf(String str) " to do that. If u facing any problem in future you can alway refer back to java doc http://java.sun.com/j2se/1.5.0/docs/api/index.html . HTH


angrycat November 24th, 2004 09:52 AM

Im afraid I do not know how to answer your about closing sessions, but once a user closes their browser they will lose connectivity to their session anyway. By this I mean your server may keep the session open for x amount of time, but the client will not be able to re-connect to it once they have lost their 'end' of the session.

My site works in the way you desire without forcing sessions to close.
Every time I re-open the browser I have to log on again.

All times are GMT -4. The time now is 11:55 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.