Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > J2EE
|
J2EE General J2EE (Java 2 Enterprise Edition) discussions. Questions not specific to EE will be redirected elsewhere.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the J2EE section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 23rd, 2004, 07:05 PM
Registered User
 
Join Date: Nov 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default JSP string find characters

Hi,
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

Nick




 
Old November 23rd, 2004, 09:26 PM
Authorized User
 
Join Date: Jul 2003
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to yuji_chen
Default

Hi,
  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

regards
yuji


 
Old November 24th, 2004, 09:52 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 204
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Replacing multiple characters in a string philboparker BOOK: XSLT Programmer's Reference, 2nd Edition 0 May 20th, 2008 04:38 PM
Replacing characters in a string semilemon C# 2005 2 June 16th, 2006 11:31 PM
Find and Replace 2 characters at once!! HELP scovitch65 VB.NET 2002/2003 Basics 2 March 18th, 2006 01:40 AM
swapping characters in a string pritz VB How-To 1 August 22nd, 2005 12:19 PM
How to eliminate special characters from string dadahonde VB How-To 2 March 11th, 2005 05:14 AM





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