Hellobilly

Posted : admin On 4/9/2022
Hellobilly Rating: 7,5/10 6330 votes
HellobillyHellobilly

Getting Started With Servlets

LinksComments
1. MyFirstServletThe 'Hello World' of servlet programming. Source: MyFirstServlet.java

2. MySecondServlet

FormWithStuff.html

The second servlet. This one involves form processing. The form includes text, select, radio, and checkbox objects. Source: MySecondServlet.java

3. SessionExampleWithAttribute

BookRecommendation2.html

Adopted from Deitel and Deitel's Internet and WWW: How To Program. This shows an example of session tracking. The Java code can be found in SessionExampleWithAttribute.java.
4. CoffeeThis webapp extends the InsertCoffees program by selecting the coffees inserted using a simple servlet and JDBC. Code: GetCoffee.java Access DB: coffee.mdb

5. GetCoffeeWithError

(run from localhost)

The 'Hello World' of servlet debugging. Note the output of System.out.print() statements in the d:javaJRun3logsdefault-out.log. Also, Note the error messages in the d:javaJRun3logsdefault-err.log. Source: GetCoffeeWithError.java
6. RegisterEmailURLServletThis servlet shows how one can
* 1. Write a doGet method to return an HTML form
* 2. Write a doPost method to retrieve the values in the form and insert them
* into an Access DB (called Student.mdb). The Java source is RegisterEmailURLServlet.

Shaggymaxx, XXXFang69 Mike8231, HaroldRamis6699, MetalSinger81 youn4, tyggrrrjay Youngbuff.

JSP (the examples given below are presented in the document JSP Examples for 353.doc)

  1. Hello Hello Hello HelloBilly Boy: My name’s Billy. I live in Zerkalny. I am a good boy.
  2. Puts the Webmaster in complete control. DirectDNS, Bannerless hosting, SSL Certs, Free Email Forwarding.
HelloBilly.jspHow is this different from HelloBilly.html?
date.jspThis shows a JSP expression
Hello7Times.jspThis shows a JSP Scriptlet
RegisterToDB.htmlThis shows a JSP that gets the parameters and invokes the functionality of another class to store the parameter values into an Access DB
IncludeExamples.jspThis shows the difference between compile time and run time includes
Sun's Tutorial on JSP, JavaBeanAn easy to follow example of how to setup JSP page that makes use of JavaBean.
Shopping Cart Example from Murach's textThis shows how a numbers of JSPs and servlet work together. The whole project has been exported to a 'project interchange' file, a format that allows one to easily export and import a project to share with team members. The file is available at ShoppingCartJSP-ProjInterchange.zip (and in t:itk353). Just create a Dynamic Web Project and import this file into the project. Select both the ShoppingCartJSP and ShoppingCartJSPEAR projects when prompted. Everything will be put into the right places! Note: the application reads a file named AllProducts.txt and assume that it is in H:.

More Sample Applications

Hellobilly

Hello Billy Marchiafava

LinksComments
1. Core Web ProgrammingThis is the link to the Core textbook's website.
2. JRun Code SamplesThe servlet samples from JRun 3. To run them off the local machine, make sure that the JRun Default Server is running in 127.0.0.1 (i.e.,localhost), listening to port 8100. Then, point to http://localhost:8100/demo/servlets/index.html
3. DukeBookStoreComprehensive example with Session Tracking, Shopping Cart, and 'DB' (simulated databases only)) [Source files] Note: This is available in T:ACS353DukeBook. Just create a web application called DukeBookin JRun and copy all the files in the directory to the D:JRunserversdefaultDukeBook folder. When done, just type:

http://localhost:8100/DukeBook/html/bookstore.html

4. VistasAnother application that makes use of servlets, JSP, JDBC, and JavaMail. The files are in the folder T:ACS353vistas
5. BarterZoneA Web app that uses servlets, JDBC, and email. Use the id of 1 and password of 1234 to log in as a member. The files are in the folder T:ACS353examples. Note the web application you need to create for this is 'examples' (not a very descriptive name but that is what was used before).
6. CoffeeExtraShotThe same as Coffee but puts the retrieval result in HTML table and added a Date field. Code: GetCoffeeExtraShot.java Access DB: coffee.mdb
7. CoffeeExtraExtraShotExtends CoffeeExtraShot by incorporating a JavaScript segment. This is to show that when returning an HTML page, one can have JavaScript embedded. Code: GetCoffeeExtraExtraShot.java Access DB: coffee.mdb

Bonus credits [3 pts]: This app runs perfectly fine from the localhost but the animation is messed up when run from the my server. Why? Give the reason and provide a solution.

8. KidsBooksPage

TechBooksPage

Another shopping cart example from Hall (Core Servlets and JSP). This shows session tracking and shopping cart. Note that this web application resides in the coreservlets package under MyProject. Thus, the way to invoke a servlet in this app is:

To make it easier for one to examine and use this sample app, I have zipped the Websphere workspace into WSADWork.zip. To use it, simply rename your H:WSADWork, say to H:WSADWorkOld, and unzip the above to your H: drive.

This is also available in T:itk353WSADWork as well.

9. Majestic Video++ SystemThe project interchange file is available at t:itk353Majestic-ProjInterchange.zip. (It is also available at Majestic-ProjInterchange.zip) Simple import that into your workspace (File > Import > Project Interchange > select the zip file > check both the entries (Majestic and MajesticEAR) > OK). You need to also setup the Access database, which needs to be referred to by the DSN majesticDB. The Access file is availble at majestic.mdb. When all is done, simply run the index.jsp page.