Return-Path: Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 80063 invoked from network); 1 Feb 2001 00:59:09 -0000 Received: from mercury.sun.com (192.9.25.1) by h31.sny.collab.net with SMTP; 1 Feb 2001 00:59:09 -0000 Received: from taller.eng.sun.com ([129.144.174.34]) by mercury.Sun.COM (8.9.3+Sun/8.9.3) with ESMTP id QAA27958; Wed, 31 Jan 2001 16:59:16 -0800 (PST) Received: from eng.sun.com (d-ucup02-251-159 [129.144.251.159]) by taller.eng.sun.com (8.9.3+Sun/8.9.3/ENSMAIL,v2.0) with ESMTP id QAA22330; Wed, 31 Jan 2001 16:59:15 -0800 (PST) Message-ID: <3A78B52E.AB2C90A@eng.sun.com> Date: Wed, 31 Jan 2001 17:00:31 -0800 From: "Craig R. McClanahan" X-Mailer: Mozilla 4.76 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: tomcat-dev@jakarta.apache.org CC: tomcat-user@jakarta.apache.org Subject: Re: REPOST : extracting jsp filename from generated class References: <003201c08bd2$39fd52b0$5f05a8c0@tfmx.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Shahed Ali wrote: > Hi all, > > Sorry for this repost. > > >From within a jsp page, I need to know the name of the jsp page. > What do you mean by the "name" of the page? JSP pages have URIs used to access them (which you can get via request.getRequestURI()), but they do not really have a notion of a "name" other than that. > > If I do a <%=this.getClass()%>, I get a string which represents the class > name > of the generated servlet. > > Is there some standard way in which I can extract the jsp page from that > name ? > No ... servlet containers are free to name the generated classes in any way that they see fit. Even if you duplicated the rules of a particular version of a particular servlet container, your app would not be portable to any other server. You should also be aware that the class name will be different each time you modify the page (so that the code gets regenerated) in many containers. > > Another Qs :- How does Tomcat know that a certain jsp page maps to > a certain class ?. Because it created that mapping in the first place -- within the JSP servlet (Jasper) there is a "name mangler" that performs this transformation. You could look inside the Jasper source code for the specific implementation being used in Tomcat. > > If I can access that data, then I can possibly lookup the pagename. > > Any clues ? > > Thanks > Shahed. > Craig McClanahan