Download First step to securing servers and the data lying there is to set up a

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

URL redirection wikipedia , lookup

Transcript
COMPUTING SUBJECT:
Servlet Basics
TYPE:
Assignment
IDENTIFICATION:
Servlet
COPYRIGHT:
Michael Claudius
LEVEL:
Easy
TIME CONSUMPTION:
2 hours
EXTENT:
50 lines
OBJECTIVE:
Servlet html i/o declaration
PRECONDITIONS:
Core Servlets & Servlet Ch. 1, 3, 4
COMMANDS:
IDENTIFICATION: SERVLET FORMS/MC
The Mission
You are to make a Web project based on some .jsp page files and a few Java classes in a related
package.
Useful links for this assignment
http://www..coreservlets.com Site for all kind of information
http://volume1.coreservlets.com/archive/index.html Code examples from the book
Hints on Settings
If you during the assignment get an error like ”Service denied. Port already in use”, then the port
numbers used by the Tomcat/GlassFish server are reserved or already in use and must be changed.
In Netbeans:
Select Tools -> Servers
And change the port numbers to e.g. server port = 8084 and shutdown port = 8024.
1. Downloading
You are now to use some predefined servlet .java files and some predefined .html files (Ch4 Java
Files.zip) which you can download from your teacher’s home page. Unzip the .java files to a folder.
In Netbeans the servlets have to be registered in web.xml and when operating the servlets have to
be registered in the web.html file. Therefore it is easiest to create the files in Netbeans and then
copy and paste the content of the doGet method into the content of the processRequest method.
Note: In the next assignments you are to compile run various programs but the most important is
that you try to understand the code; e.g. by answering the questions given.
2. ThreeParameters
Create a new Web servlet file “ThreeParameters”.Copy and paste the content of the doGet –method
in the downloaded version into the new file.
Don’t run it !
Instead copy the html fileThreeParameters.html to the folder Web in the project.
Activate the .html file, fill out parameters and submit.
What happened ? How is ThreeParameters.java activated.
3. ShowParameters
In the same way create “ShowParameters and paste the content of the doGet-method.
How are the parameters processed ?
Explain the use of Enumeration.
4. Fool around
Take some of the other files and use them in a similar way.