how to deploy servlet in Web browser?

可紊 提交于 2019-12-11 20:37:21

问题


I have create My First "Hello World" Servlet in Eclipse. It is running properly in Eclipse Browser. I'm using Apache Tomcat, and it is also running properly.

How can I deploy my Servlet in Web browser like Internet Explorer, Chrome, Mozilla Firefox etc? I don't want to deploy my servlet in Eclipse browser.


回答1:


You don't deploy to a browser. You deploy to a server. Just deploy to server and start the server the usual way (as you did in Eclipse). Then, just enter the servlet's URL in the address bar of the webbrowser of your choice yourself. It can be exactly the same URL as you see in Eclipse browser's address bar. If necessary, bookmark this URL in your favourite webbrowser so that you don't need to copypaste/enter it yourself everytime.




回答2:


Go to Window menu in eclipse then click on "web browser" then click on "Internet explorer".That't it.....




回答3:


Firstly, servlets are not deployed in Browsers, they are deployed on server and accessed through browsers.

Secondly: what you can do is, just copy paste the URL from eclipse browser to mozilla or chrome to access your servlet. All that you have to make sure is that the tomcat server configured in your eclipse and on which application containing this servlet is deployed, is up and running.

If you want to access this without eclipse tomcat, goto the local tomcat installation, you should have a deploy folder there, create a war file of your webapplication and copy it to the deploy folder and start te tomcat server.




回答4:


You deploy application in WebServer (Tomcat in your case) not in browsers.

In eclipse, add your application in tomcat server (in servers view), start the server and open a browser of your choice.

Then put in url http://localhost:8080/NameOfYourServlet




回答5:


Just copy the url from eclipse browser and paste on url bar of which browser you need. There is no separate deploy for each browser. Another thing you can change your eclipse default browser.If you changed, project will start in browser you selected instead of eclipse browser.



来源:https://stackoverflow.com/questions/17251148/how-to-deploy-servlet-in-web-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!