The Artima Developer Community
Sponsored Link

Java Buzz Forum
How to run jsp program in eclipse tomcat

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
instanceof java

Posts: 576
Nickname: instanceof
Registered: Jan, 2015

instanceof java is a java related one.
How to run jsp program in eclipse tomcat Posted: Aug 5, 2016 11:48 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by instanceof java.
Original Post: How to run jsp program in eclipse tomcat
Feed Title: Instance Of Java
Feed URL: http://feeds.feedburner.com/blogspot/TXghwE
Feed Description: Instance of Java. A place where you can learn java in simple way each and every topic covered with many points and sample programs.
Latest Java Buzz Posts
Latest Java Buzz Posts by instanceof java
Latest Posts From Instance Of Java

Advertisement
  • Hi friends today we will see basic example of how to run jsp (java server pages) program using tomcat server in eclipse IDE.
  • For this we need to create dynamic web project in eclipse
  • Lets see how to run jsp program in tomcat server step by step.
  • Print hello world using jsp program

Required software: 



  • After downloading eclipse and tomcat server. open eclipse and add server and select tomcat version and giver downloaded tomcat folder path.

Step 1: Open eclipse and create dynamic web project:
  • Now we need to create dynamic web project for this in eclipse 
  • New => other=> web=> Dynamic web project


how to run jsp program in tomcat server eclipse



Step 2 : Create a dynamic web project

  • Click on next => and give MyFirstJsp as project name.
  • Click on Next=> click next here select generate xml deployment descriptor check box
  • And click on finish.
  • So now project will be created and with default xml file.


  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javae
  4. /web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  5. http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  6.   <display-name>MyFirstJsp</display-name>
  7.   <welcome-file-list>
  8.     <welcome-file>index.html</welcome-file>
  9.     <welcome-file>index.htm</welcome-file>
  10.     <welcome-file>index.jsp</welcome-file>
  11.     <welcome-file>default.html</welcome-file>
  12.     <welcome-file>default.htm</welcome-file>
  13.     <welcome-file>default.jsp</welcome-file>
  14.   </welcome-file-list>
  15. </web-app>
Step 3: Create a JSP page
 

run jsp on eclipse


  • Right click on web content folder and select new => JSP file => give index.jsp


Step 4 : Edit Jsp page

  • Edit the JSP page and give Page title and in the body section create one paragraph tag and write some text like Hello world.


  1. <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  2.     pageEncoding="ISO-8859-1"%>
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.or
  4. /TR/html4/loose.dtd">
  5. <html>
  6. <head>
  7. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  8. <title>Welcome</title></head>
  9. <body>
  10. <p>Hello World</p>
  11. </body>
  12. </html>


Step 5: Run dynamic web project using tomcat server

  • So index.jsp is present in welcome file list of web.xml file then whenever server starts it loads welcome file i.e index.jsp
  • We can give any name t our jsp but it should present in web.xml as welcome file
  • <welcome-file>index.htm</welcome-file> . no need of other files which names are created by default we can delete those things.
  • Right click on the project and => run as => run on server=> select tomcat version = >add our project if not added click on finish. 
how to compile jsp program in tomcat

Read: How to run jsp program in eclipse tomcat

Topic: Do developers really care about security? Previous Topic   Next Topic Topic: 26% off Tracer360 All-Season Illuminated Reflective LED Visibility Vest - Deal Alert

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use