Topic Java EE installation (Eclipse, glassfish, etc.) Eclipse configuration for EE Creating a Java...

Preview:

Citation preview

Topic

• Java EE installation (Eclipse, glassfish, etc.)• Eclipse configuration for EE• Creating a Java Web Dynamic Project• Creating your first servlet

Start Eclipse and Add a New Server

View Installed Server Adapters

Download a New Adapter for Glassfish

Select Glassfish and Click Next

Accept License and Click Finish

Glassfish Server Tools will be Installed

Restart the Eclipse IDE

View Glassfish Configurations

Click Glassfish Server Properties

Switch Glassfish Location

Create a New Project

Select Dynamic Web Project

Name the Project ‘SimpleServletProject’

Select src as the Java Files Directory

Select ‘Deployment Descriptor’

Add the Navigator Window in view

Navigator window is similar to File Locations

View differences between Project explorer and Navigator window

View the web.xml file

Understand the welcome-file in web.xml

Add a new html file in your Project

Add a new html file in your Project

Name the html file’index.html’

Edit the html file

Run your web Project

View the outputs!

Change url and view changes

Create your first Servlet

Select ‘Servlet’

Enter package name, class name

Enter a description and edit URL mapping path

Select only ‘doGet’ method

View your Servlet from Navigator

Enter code in ‘doGet’ method

Run your project [you can also run the servlet alone]

View output in console, you need to enter the path of servlet

Now, write codes that will output in html page

Refresh page and view output

Modify code and do something else in html

View output difference! That’s the html!

Recommended