how to deploy servlet in Web browser? - eclipse

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.

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.

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

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.

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

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.

Related

How to automatically opne browser with my localhost url when I run wildfly server on eclipse?

For now I just right click on wildflay server in my eclipse and click start. After the starting copleted I open the browser and type the url:
http://127.0.0.1:8090/myproject/
Is there a possibility to run this url automatically using eclipse when ever I start wildfly server?

How to run on JBoss html file with Eclipse

I am creating a Static Web Project using Eclipse Juno Service Release 2.
My problem is that I have an HTML file (very simple, created automatically with Eclipse with HTML5 template) in this project and I would run it in an external browser (for example, Chrome) using as Server JBoss 7.1.
I have already configured properly JBoss in Eclipse, I can run/stop it without problems.
I have configured as Web Browser Chrome.
I don't know how run the single html file in my localhost:8080.
Someone can help me?
If you have created the project then you would have to deploy it.
Refer to http://www.mastertheboss.com/eclipse/jboss-eclipse/jboss-and-eclipse?showall=&start=1 which describes how to deploy an application.
And your URL to the file would be http://localhost:8080/yourProjectName/htmlFileName
Example: http://localhost:8080/TestApp/index.html

can open webapp but not tomcat home page

When I deploy a webapp to a server by eclipse i can visit the webapp's sites with external browsers with no problems.
But I can't open localhost:8080 to visit tomcat's own page.how so?
Thanks in advance!
By default, Eclipse will not use the web container (tomcat in your case) files directly. It will copies some required files into <your_workspace>/.metadata/.plugin/org.eclipse.wst.server.core/ and run server from there.
The localhost:8080 page in tomcat are actually a default webapp call ROOT, you can find it in $CATALINA_HOME/webapps/ROOT.
When Eclipse copies web container files, it DOSE NOT include deployed application, that's the reason you cannot see root page.

Tomcat and Eclipse server configuration

I installed tomcat on my ubuntu. When i create a new Dynamic Web Project I choose the tomcat 7 server. When I launch my page it works on localhost:8080/app/page but if I go on localhost:8080 it give me a 404 error.
If i start tomcat server with an external script like /etc/init.d/tomcat start, it works but I cannot launch my app because it says that the port 8080 is already occupied (by the other instance of tomcat).
I'm confused on how set everything, I would start tomcat at boot and link that instance for my apps.
Can you explain how I hato to do?
Open the server configuration in the Servers tab on Eclipse. On "Server Locations", mark "Use Tomcat installation".
EDIT: to be more precise, this will make Eclipse "take control" of your Tomcat folder. So it will not just make a replica on eclipse .metadata and deploy only your apps on it; instead it will be like if you ran bin/startup, but using some of the configuration defined on Servers view. So if you go localhost:8080 you will see the Welcome page, because /ROOT is now started by Eclipse.
So, I am not against "Starting/Stopping" the server from eclipse but to keep it simple, I think you can stop the server from eclipse (Click on windows/showview/Servers and then stop the server). Then I think you should not get an error if you start tomcat again from external script. Then you can right click on your dynamic web project in eclipse and export it as a war file inside tomcat-install--dir/webapps. Where your web application is available (on which context) depends on the web.xml file. If you need further info on this plz let me know.

Where does Tomcat in Eclipse store the expanded WAR?

When I launch my web application from Eclipse Indigo, where does Tomcat 7 store web application folder? It is not located in Tomcat's own webapp folder. Why I can not access Tomcat's default home page (I talk about http://localhost:8080), if it started under Eclipse? If I start tomcat manually (thruogh the startup.bat), I can access http://localhost:8080.
Doubleclick the Tomcat server entry in Servers view and check the Server Locations section. The path is in there and you can also configure in there if Eclipse should use the Tomcat installation instead of the workspace metadata (which is the default setting).
Note that the server must be published with no modules present to make changes. I.e. stop the server, remove all projects and publish the server.
This will also make the Tomcat homepage available.
See also:
Tomcat started in Eclipse but unable to connect to http://localhost:8085/
Per default it will deploy your application in a subfolder of .metadata-folder from your workspace.