Well, that example is actually looking for the page itself. My suggestion just looks for a page name in the entire string. Your example is probably better because it ignores case, etc.
I would use getRequestURI() instead of getServletPath(), but then again I'm no super-developer. You'll have to hack around to get a 100% shot at finding the page name and considering case, etc. Something like using a StringBuffer and StringBuffer.substring along with getIndexOf() to grab the contents of the URI from the last "/" to the end of the string. John > -----Original Message----- > From: Jason Johnston [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, December 18, 2002 10:31 AM > To: [EMAIL PROTECTED] > Subject: RE: How do I get the requested page from the Request Object? > > > Thanks a lot. I'll go ahead and take that approach. Though I started > with the following example from a book. > . > . > . > String URI = request.getServletPath(); > if(URI.equalgnoreCase("/index.html")) > forwardTo ="/index.jsp"; > else { > > forwardTo="/article.jsp"; > request.setAttribute("includepage",URI); > } > > . > . > . > It then goes on to call the request dispatcher and forward to the > forwardTo. Does this actually work for anyone. On my machine, > getServletPath() never returns that part of the URL. > > -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
