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: file path problem
Date Mon, 06 May 2002 19:16:11 GMT
jack,
    I have a quick question. in your example below, i.e.

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


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


thanks
bharani

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


Hello Bharanidharan,

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

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

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

If you are at:

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

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

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

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

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

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

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

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

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


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

Jake

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
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:
<mailto:tomcat-user-unsubscribe@jakarta.apache.org>
MB> For additional commands, e-mail:
<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