简体   繁体   中英

Open JSP Page directly in brower using URL

I am using Apache-Tomcat-7 and I placed a jsp page( myjsp.jsp ) in

...\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\desktop\

I have started the tomcat and trying the following URL to open the jsp page

http://localhost:8089/desktop/myjsp.jsp

But it is giving 404 . I donot want it to open through other means. Can any body tell me that what I am doing wrong?

PS localhost:8089 works fine for other applications and tomcate is configured to this port-8089.

EDIT

When I placed the myjsp.jsp in ROOT folder under

...\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT\

and try

http://localhost:8089/myjsp.jsp

Now it works. So what is the reason that in the desktop folder the jsp was NOT found

OR

how can I access myjsp.jsp if it is placed within desktop folder?

Well one way is the way you have already done (by deploying it at the root context of the tomcat server). Although it would seem to work fine, I won't recommend doing that. Changing root context of tomcat to some other application/pages is for other purpose.

The best way to do is to create a small project (you need a dynamic web project with a proper deployment descriptor --> eclipse will do all this job by just a button click), then deploy this project to your tomcat server.

So lets say if you create your project as MyProjectOne, then just place your JSP page (lets call it test.jsp) under WebContent or src/main/webapp folder and you will be able to view your page as http://localhost:8089/MyProjectOne/test.jsp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM