tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mani, Bharanidharan" <bhar...@scr.siemens.com>
Subject RE: Re[2]: file path problem
Date Mon, 06 May 2002 20:14:21 GMT
Jack.. i am sorry its very complicated for me and i didnt understand
anything you said.. I am new to tomcat environment. 

I have a servlet under
/webapps/jetspeed/Web-inf/classes/myservlet/NewLogin.class. In that servlet
i have to call a html file that is kept under
/webapps/jetspeed/Web-inf/templates/vm/navigations/html/loggedinportlet.html
. 

I have the following code in web.xml

<!-- The mapping for the invoker servlet -->
  <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
  </servlet-mapping>



how do i map the html file in my NewLogin.class servlet. i still dont get
how the webpath is mapped to the system file path... 

sorry for the inconvenience.

please let me know..

thanks
bharani.
-----Original Message-----
From: Jacob Kjome [mailto:hoju@visi.com]
Sent: Monday, May 06, 2002 3:52 PM
To: Tomcat Users List
Subject: Re[2]: file path problem


Hello Bharanidharan,

/servlet/ is a mapping provided for you by Tomcat.  In fact, take a
look in the web.xml in $TOMCAT_HOME/conf and look for that mapping:

<!-- The mapping for the invoker servlet -->
  <servlet-mapping>
    <servlet-name>invoker</servlet-name>
    <url-pattern>/servlet/*</url-pattern>
  </servlet-mapping>


If tomcat didn't provide this, you would have to set up a mapping for
each and every one of your servlets that you wished to run.  With
this, you can run any servlet in your webapp by naming the servlet
with the full package name.

When you want a more convenient URL to invoke your servlet, you can
provide your own mapping in a similar way as the above example in your
own web.xml.

Keep in mind that the /servlet/ mapping is *not* guaranteed to exist
across containers, although I would imagine that a number of
containers might just copy Tomcat's lead on this to be compatible.

Jake

Monday, May 06, 2002, 2:16:11 PM, you wrote:

MB> jack,
MB>     I have a quick question. in your example below, i.e.

MB> http://www.myserver.com/mywebapp/servlet/myservlets.login


MB> you mean to say "servlet" in the URL is mapped to "Web-inf" directory
under
MB> jetspeed??.. i am still unable to comprehend the url path.


MB> thanks
MB> bharani

MB> -----Original Message-----
MB> From: Jacob Kjome [mailto:hoju@visi.com]
MB> Sent: Monday, May 06, 2002 1:08 PM
MB> To: Tomcat Users List
MB> Subject: Re: file path problem


MB> Hello Bharanidharan,

MB> Don't confuse the system file path with the URL path.

MB> What URL is in your browser on the page that contains the
MB> window.open()?

MB> window.open will try to find the page relative to your domain root.

MB> If you are at:

MB> http://www.myserver.com/mywebapp/servlet/myservlets.login

MB> Then the code you have for window.open will be attempting to find a
MB> directory on the server that simply doesn't exist.  You would be able
MB> to get to your "myhtml" directory with this, though.

MB> window.open("../myhtml/loggedin.html");

MB> However, you can't count on this, because what if you did a servlet
MB> mapping and you got to your login servlet via:

MB> http://www.myserver.com/mywebapp/login

MB> now, the proper way to get to your html page would be:

MB> window.open("myhtml/loggedin.html");

MB> The issue here is that you are hard-coding a path that can't be
MB> assumed.  What you should do, instead is the following:

MB> out.println("window.open(\"" + req.getContextPath() +
MB> "/myhtml/loggedin.html\")";


MB> After doing this, it doesn't matter where you invoke your servlet from
MB> as long as the static html is in the proper location relative to the
MB> root of the webapp.

MB> Jake

MB> Monday, May 06, 2002, 11:30:37 AM, you wrote:

MB>> Hi all,
MB>>        I have my login servlet under
MB>> webapp/jetspeed/web-inf/classes/myservlets/login.class. I invoke a
MB>> loggedin.html from this servlet. loggedin.html is located under
MB>> webapps/jetspeed/myhtml/loggedin.html. so in my servlet, i gave 


MB>>       window.open("../../../myhtml/loggedin.html");.

MB>> but apache gives error saying resource /myhtml/loggedin.html couldnt
not
MB> be
MB>> found. I tried copying this file to various directories including the
MB>> template directories under jetspeed but no success.. can someone how
the
MB>> file path is specified in jetspeed..


MB>> thanks
MB>> bharani.

MB>> --
MB>> To unsubscribe, e-mail:
MB> <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
MB>> For additional commands, e-mail:
MB> <mailto:tomcat-user-help@jakarta.apache.org>






-- 
Best regards,
 Jacob                            mailto:hoju@visi.com


--
To unsubscribe, e-mail:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:tomcat-user-help@jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message