Skip to content

Commit 3ccdf4f

Browse files
author
Thomas Weise
committed
Fixed Errors in Documentation
1 parent 3e5908f commit 3ccdf4f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ Here I provide the source codes of the examples that I use in my distributed com
55
1. [sockets](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/)
66
1. in [c](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/c)
77
2. in [java](http://github.com/thomasWeise/distributedComputingExamples/tree/master/sockets/java)
8+
89
2. [HTML, CSS, and JavaScript](http://github.com/thomasWeise/distributedComputingExamples/tree/master/html/)
10+
911
3. [Java Servlets](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServlets/)
12+
1013
4. [JavaServer Pages](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples)
14+
1115
a. [deployable examples](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples)
1216

1317
Since I also use the same code in my slides, there are some special comments such as `//(*@\serverBox{2)}@*)` for formatting in my codes ... you can safely ignore them ^_^

javaServerPages/examples/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,48 +10,48 @@ This small JSP creates a [HTML](https://en.wikipedia.org/wiki/HTML) page printin
1010

1111
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/greetings.jsp](http://localhost:8080/myJSPs/greetings.jsp).
1212

13-
1. [`greetings.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/greetings.jsp)
13+
1. [`greetings.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/greetings.jsp)
1414

1515
### 1.2. Print Client Address: `printClientAddress.jsp`
1616

1717
This small JSP creates a plain text response containing the [IP address](https://en.wikipedia.org/wiki/IP_address) of the client.
1818

1919
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/printClientAddress.jsp](http://localhost:8080/myJSPs/printClientAddress.jsp).
2020

21-
1. [`printClientAddress.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/printClientAddress.jsp)
21+
1. [`printClientAddress.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/printClientAddress.jsp)
2222

2323
### 1.3. Count Web Page Visits (unsynchronized): `counterUnsynchronized.jsp`
2424

2525
This JSP counts the number of times it was visited. It does so by creating a `long` member variable named `numVisitors`. Whenever the servlet is loaded, this variable will be incremented by one and the result is printed. This incrementing and printing step is not protected with [synchronization](http://docs.oracle.com/javase/tutorial/essential/concurrency/sync.html). It is not an [atomic operation](https://en.wikipedia.org/wiki/Linearizability). This means, the results can potentially become inconsistent. At the same time, this [critical section](https://en.wikipedia.org/wiki/Critical_section) is extremely small and executes extremely fast. This means that the error is virtually impossible to reproduce and to find. If such a programming mistake is made, it might only be discovered in production and would be extremely hard to identify.
2626

2727
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/counterUnsynchronized.jsp](http://localhost:8080/myJSPs/counterUnsynchronized.jsp).
2828

29-
1. [`counterUnsynchronized.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/counterUnsynchronized.jsp)
29+
1. [`counterUnsynchronized.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/counterUnsynchronized.jsp)
3030

3131
### 1.4. Count Web Page Visits (synchronized): `counterSynchronized.jsp`
3232

3333
This JSP counts the number of times it was visited, but avoids the synchronization problem from the previous example above. It again creates a `long` member variable named `numVisitors`. This counter is increased by the private `synchronized` method `long __inc()`. This fixes the previous error.
3434

3535
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/counterSynchronized.jsp](http://localhost:8080/myJSPs/counterSynchronized.jsp).
3636

37-
1. [`counterSynchronized.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/counterSynchronized.jsp)
37+
1. [`counterSynchronized.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/counterSynchronized.jsp)
3838

3939
### 1.5. Rate this Course: `rating.jsp`
4040

4141
This JSP includes a small form which allows you to rate the distributed computing course. You can choose between six different ratings. Clicking the submit button will send your chosen rating back to the same page. The internal counters will be updated in a synchronized fashion (see example 1.4 above). The response page of the rating contains a section displaying the ratings received so far. This example can therefore be used to get a rough impression on how the data from web forms is sent to a server and how the server can process it.
4242

4343
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/rating.jsp](http://localhost:8080/myJSPs/rating.jsp).
4444

45-
1. [`rating.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/rating.jsp)
45+
1. [`rating.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/rating.jsp)
4646

4747
### 1.6. Shopping Cart: `shoppingCart.jsp`
4848

4949
This JSP is an example for [session](https://en.wikipedia.org/wiki/Session_(computer_science)) data. A session is enriched with a [JavaBean](https://en.wikipedia.org/wiki/JavaBeans) named `cart` bound to class `shopping.Cart`. This bean basically holds a list of items in the user's shopping cart. The `shoppingCart.jsp` loads the bean, displays the contents of the shopping cart, and *includes* another JSP named `shoppingCartForm.jsp` which displays a form that allows us to add items to or remove items from the shopping cart. It therefore creates a form which, upon submission, sends it data back to the hosting JSP (`shoppingCart.jsp`). This data includes the parameter `submit`, which is either `add` or `remove` (or `null`, in which case nothing needs to be done) and the parameter `item`, representing the item to be added or removed. The `cart` bean therefore has read-only properties `add` and `remove` which receive the value of `item` and update the internal list, i.e., the content of the user's shopping cart. If we open this JSP from multiple different browsers, each will have an own, unique session and, hence, an own, unique instance of `shopping.Cart`.
5050

5151
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/shoppingCart.jsp](http://localhost:8080/myJSPs/shoppingCart.jsp).
5252

53-
1. [`shoppingCart.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/shoppingCart.jsp)
54-
2. [`shoppingCartForm.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/shoppingCartForm.jsp)
53+
1. [`shoppingCart.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/shoppingCart.jsp)
54+
2. [`shoppingCartForm.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/shoppingCartForm.jsp)
5555
3. [`shopping.Cart.java`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/java/shopping/Cart.java)
5656

5757
### 1.7. Expression Language Examples: `expressionLanguageExamples.jsp`
@@ -60,24 +60,24 @@ This JSP includes a set of small examples for the expression language [EL](https
6060

6161
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/expressionLanguageExamples.jsp](http://localhost:8080/myJSPs/expressionLanguageExamples.jsp).
6262

63-
1. [`expressionLanguageExamples.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/expressionLanguageExamples.jsp)
63+
1. [`expressionLanguageExamples.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/expressionLanguageExamples.jsp)
6464

6565
### 1.8. JSTL Examples: `jstlExamples.jsp`
6666

6767
This JSP includes a set of small examples for the JavaServer Pages Standard Tag Library [JSTL](https://en.wikipedia.org/wiki/JavaServer_Pages_Standard_Tag_Library) which you can use since 2006.
6868

6969
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/jstlExamples.jsp](http://localhost:8080/myJSPs/jstlExamples.jsp).
7070

71-
1. [`jstlExamples.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/jstlExamples.jsp)
71+
1. [`jstlExamples.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/jstlExamples.jsp)
7272

7373
### 1.9. Shopping Cart with JSTL and EL: `shoppingCartJSTLEL.jsp`
7474

7575
This is basically the same example as example 1.6, the session-based shopping cart. However, now we make use of both the JSTL and EL to simplify the example.
7676

7777
If your application is running in GlassFish, you can access this JSP as [http://localhost:8080/myJSPs/shoppingCartJSTLEL.jsp](http://localhost:8080/myJSPs/shoppingCartJSTLEL.jsp).
7878

79-
1. [`shoppingCartJSTLEL.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/shoppingCartJSTLEL.jsp)
80-
2. [`shoppingCartForm.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/WEB-INF/shoppingCartForm.jsp)
79+
1. [`shoppingCartJSTLEL.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/shoppingCartJSTLEL.jsp)
80+
2. [`shoppingCartForm.jsp`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/webapp/shoppingCartForm.jsp)
8181
3. [`shopping.Cart.java`](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples/src/main/java/shopping/Cart.java)
8282

8383

0 commit comments

Comments
 (0)