Skip to content

Commit c880150

Browse files
author
Thomas Weise
committed
Improved Docu of Stand-Alone JSPs with Jetty Example
I slightly improved the README.md documentation of the stand-alone JSPs example with Jetty.
1 parent 0070254 commit c880150

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ Since I also use the same code in my slides, there are some special comments suc
1818

1919
## Licensing
2020

21-
The examples in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007](http://github.com/thomasWeise/distributedComputingExamples/tree/master/LICENSE), with the exception of everything in the directory /javaServerPages/standAloneJSPsWithJetty, which is licensed under the [Apache License v2.0](http://www.opensource.org/licenses/apache2.0.php). and which is derived from [project embedded-jetty-jsp](https://github.com/jetty-project/embedded-jetty-jsp) with copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
21+
The examples in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007](http://github.com/thomasWeise/distributedComputingExamples/tree/master/LICENSE), with the exception of everything in the directory [/javaServerPages/standAloneJSPsWithJetty]((http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/standAloneJSPsWithJetty)), which is licensed under the [Apache License v2.0](http://www.opensource.org/licenses/apache2.0.php). and which is derived from [project embedded-jetty-jsp](https://github.com/jetty-project/embedded-jetty-jsp) with copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.

javaServerPages/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ Here you can find examples for using [JavaServer Pages](https://en.wikipedia.org
77

88
## Licensing
99

10-
The examples in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007](http://github.com/thomasWeise/distributedComputingExamples/tree/master/LICENSE), with the exception of everything in the directory /javaServerPages/standAloneJSPsWithJetty, which is licensed under the [Apache License v2.0](http://www.opensource.org/licenses/apache2.0.php). and which is derived from project [embedded-jetty-jsp](https://github.com/jetty-project/embedded-jetty-jsp) with copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.
10+
The examples in this repository are licensed under the [GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007](http://github.com/thomasWeise/distributedComputingExamples/tree/master/LICENSE), with the exception of everything in the directory [/javaServerPages/standAloneJSPsWithJetty]((http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/standAloneJSPsWithJetty)), which is licensed under the [Apache License v2.0](http://www.opensource.org/licenses/apache2.0.php). and which is derived from project [embedded-jetty-jsp](https://github.com/jetty-project/embedded-jetty-jsp) with copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd.

javaServerPages/standAloneJSPsWithJetty/README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,51 @@
11
# Stand-Alone Java Server Pages with Jetty
22

3+
## 1. Introduction
4+
35
[Java Server Pages](http://en.wikipedia.org/wiki/JavaServer_Pages) (JSP) are a technology for building dynamic websites with [Java](http://en.wikipedia.org/wiki/Java_(software_platform)). They are basically a mixture of [HTML](http://www.w3.org/html/) and Java code. They run in a special server, a servlet container, which compiles them to [Java Servlets](http://en.wikipedia.org/wiki/Java_Servlet), Java objects with handler routines which are called whenever a client (user) accesses the page via HTTP(S). Thus, in order to get your JSP to run, you deploy it into a servlet container, like [Tomcat](http://tomcat.apache.org/), [Jetty](http://www.eclipse.org/jetty/), or [JBoss](http://www.jboss.org/). This means you have to install the servlet container.
46

57
This small project is an example for how you can build a "fat" `jar` which includes both the JSPs *and* the servlet container (Jetty). This `jar` is stand-alone, i.e., you can directly run the `jar` and access the server page without any installation or deployment.
68

79
You can compile it with [Maven](http://maven.apache.org/) with goals `compile` and `package`. As result, you will get the `standAloneJSPs-full.jar`, which you can run via `java -jar standAloneJSPs-full.jar` without any additional requirements. It will then start the internal servlet container and then a browser to visit the entry page. In other words, different from our [deployable JSP examples](http://github.com/thomasWeise/distributedComputingExamples/tree/master/javaServerPages/examples), you do not need a servlet container.
810

9-
## License
11+
## 2. Building and Deployment
12+
13+
### 2.1. Import Project into Eclipse
14+
15+
If you import this project in [Eclipse](http://www.eclipse.org), it may first show you a lot of errors. (I recommend using Eclipse Mars or later.) This is a Maven project, so you should "update" it first in Eclipse by
16+
17+
1. Make sure that you can see the `package view` on the left-hand side of the Eclipse window.
18+
2. Right-click on the project (`standAloneJSPsWithJetty`) in the `package view`.
19+
3. In the opening pop-up menu, left-click on `Maven`.
20+
4. In the opening sub-menu, left-click on `Update Project...`.
21+
5. In the opening window...
22+
1. Make sure the project (`standAloneJSPsWithJetty`) is selected.
23+
2. Make sure that `Update project configuration from pom.xml` is selected.
24+
3. You can also select `Clean projects`.
25+
4. Click `OK`.
26+
6. Now the structure of the project in the `package view` should slightly change, the project will be re-compiled, and the errors should disappear.
27+
28+
29+
## 2.2. Build Project in Eclipse
30+
31+
Now you can actually build the project, i.e., generate a [`jar`](https://en.wikipedia.org/wiki/JAR_%28file_format%29) file that you can directly execute on the command line and which contains both your JSPs as well as the (Jetty) servlet container:
32+
33+
1. Make sure that you can see the `package view` on the left-hand side of the Eclipse window.
34+
2. Right-click on the project (`standAloneJSPsWithJetty`) in the `package view`.
35+
3. In the opening pop-up menu, choose `Run As`.
36+
4. In the opening sub-menu choose `Run Configurations...`.
37+
5. In the opening window, choose `Maven Build`
38+
6. In the new window `Run Configurations` / `Create, manage, and run configurations`, choose `Maven Build` in the small white pane on the left side.
39+
7. Click `New launch configuration` (the first symbol from the left on top of the small white pane).
40+
8. Write a useful name for this configuration in the `Name` field. You can use this configuration again later.
41+
9. In the tab `Main` enter the `Base directory` of the project, this is the folder called `javaServerPages/standAloneJSPsWithJetty` containing the Eclipse/Maven project.
42+
10. Under `Goals`, enter `clean compile package`. This will build a `jar` archive.
43+
11. Click `Apply`
44+
12. Click `Run`
45+
13. The build will start, you will see its status output in the console window.
46+
14. The folder `target` will contain a file `standAloneJSPs-full.jar` after the build. This is the executable archive with our application.
47+
48+
## 3. License
1049

1150
This project is derived from [embedded-jetty-jsp](https://github.com/jetty-project/embedded-jetty-jsp) with copyright (c) 1995-2013 Mort Bay Consulting Pty. Ltd. Compared to that project, the main differences are
1251

0 commit comments

Comments
 (0)