<p>I would recommend:</p>

<ol>
<li>Starting by teaching students just plain HTML, CSS, and perhaps JavaScript and focus on teaching the frontend first.</li>
<li>Once students are ready for the backend, switch to using a <em>minimalist</em> framework such as <a href="http://sparkjava.com/" rel="nofollow noreferrer">Spark</a>. Have them first construct HTML using plain old string concatenation, make a big deal over how sucky that is, then switch to using a <a href="http://sparkjava.com/documentation#views-and-templates" rel="nofollow noreferrer">templating engine</a> (any one will do, so it's probably best to pick one with the best documentation).</li>
</ol>

<p>Teaching the front-end first does require you to make a "clean break" and switch away from Java, but I do think it's for the best for several reasons:</p>

<ol>
<li>It's essential context for the students to have. Many backend tutorials will assume you already have a good understanding of the frontend, so it'll likely be more confusing if you don't start with the frontend.</li>
<li>Starting from the frontend lets students get instant gratification.</li>
<li>Starting from the frontend lets you move from simplicity to complexity: you start with static websites and gradually progress to something more complex (dynamic page generation, AJAX hijinkery, etc...).</li>
</ol>

<p>I like using micro-frameworks such as Spark (for Java) or Flask (for Python) for teaching the backend. There's minimal ceremony, and micro-frameworks tend to closely mirror the HTTP request-response model, minimizing conceptual overhead. And since Spark is Java, you don't need to spend unnecessary time teaching a similar language.</p>

<p>In fact, there's even an argument to be made that the best thing to do is to ditch even micro-frameworks and start with just plain CGI or something: you literally manipulate strings, and that's it. Then, time permitting, you have students write their <em>own</em> framework/templating engine/what-have-you on top of that.</p>

<p>Basically, I view web development as one giant exercise in working with abstractions, and I feel one of the best ways to make students understand an abstraction is to have them build it from the ground-up/start without the abstraction. Web frameworks and trends come and go at a ludicrously fast pace, so I think it's particularly important in web development to focus on the fundamentals rather then trends. (You can see more about this philosophy <a href="http://www.pgbovine.net/teaching-web-programming.htm" rel="nofollow noreferrer">here</a>)</p>

<p>In particular, I like emphasizing that web frameworks are just complex ways of processing and sending strings: I think it helps demystify a lot of things, and gives students a concrete footing to help build their understanding of these abstractions.</p>

<p>(Tangent: you can work in all kinds of interesting CS topics depending on how much you want to commit to this "build everything yourself" model. For example, you can talk about compilers, parsers, and DSLs if you have students build their own templating engine; you can talk about NFAs, DFAs, regexes and such if you have students build their own regex engine to match routes... This is all probably overkill if your focus is just on teaching web development though.)</p>

CC BY-SA 3.0
2017-09-04T14:52:49.380Z
2017-09-04T15:12:25.080Z
2017-09-04T15:12:25.080Z
Michael0x2a
<p>I would recommend C#, more specifically .NET with MVC. </p>

<ol>
<li>It's fairly straightforward to move from Java to C#, seeing how they are both pretty much the same in terms of usage and maturity as a widely used OOP language.</li>
<li>.NET allows you to use controllers + Views + Razor Engine which in turn allow you to use C# to generate most of the web portion i.e. HTML + CSS + JS. </li>
</ol>

<p>On a related note, the days of programatically generating web code are behind us, now that JS based libraries are becoming ever more powerful. So, I have to opine here that teaching dynamically generating web pages using a Java like language is perhaps not the best step forward. They are better off taking up jQuery (or react if they are Facebook/Instagram fans).</p>

CC BY-SA 3.0
2017-10-01T13:34:03.943Z
I strongly disagree with the choice of proprietary technology which only really runs on top of another proprietary technology for academic use. (Yes, I know there's open-source version of ASPX and Mono, but they don't really work...) But even if they did, it would be far too easy for students to be led astray and into the non-free world of perpetual hand-holding and hand-twisting performed by large corporations on unsuspecting users.
wvxvw
CC BY-SA 3.0
2017-09-04T11:27:44.220Z
2017-09-04T11:29:16.983Z
2017-09-04T11:29:16.983Z
Jay
<p>I just started teaching an introduction to web development to high school students (they have the most basic knowledge of java) and this year my school has decided to make a change in the curriculum. </p>

<p>Previously we used JSP to dynamically generate pages, but now we decided to look for a different technology to replace JSP. </p>

<p>So, I am looking for a language for dynamically generating webpages (again, a replacement for what JSP does: servlets in Java). Bearing in mind that they know a bit of java, it would be highly preferable to use a language that is similar to Java. </p>

<p>I am well aware that there might not be a Java like language for this (other than JSP), but the more the language is similar to Java, the better. </p>

<p>If they end up learning a new language (not necessarily one for dynamic webpage generation), all the better.</p>

CC BY-SA 3.0
2017-09-04T09:49:43.173Z
Are you after creating dynamically generated pages, or dynamic pages? (The latter being pages with code embedded in them. So that the page can run code and change it self, without talking to the server.)
ctrl-alt-delor
CC BY-SA 3.0
2017-09-04T10:06:07.037Z
@ctrl-alt-delor edited to clear that part.
ItamarG3
CC BY-SA 3.0
2017-09-04T10:12:34.260Z
Is javascript close enough? If so then I would suggest you look at couchdb.
ctrl-alt-delor
CC BY-SA 3.0
2017-09-04T11:25:59.700Z
Why do you want to move away from Java? The reasons might change the answers as well.
Sirko
CC BY-SA 3.0
2017-09-04T11:27:14.357Z
@Sirko It's not Java I'm running from; it's JSP specifically.
ItamarG3
CC BY-SA 3.0
2017-09-04T11:41:32.073Z
Then maybe turn towards a more client focused architecture like Angular in the frontend and Spring for Rest services in the backend. Not sure, however, how suitable this is for high schools students.
Sirko
CC BY-SA 3.0
2017-09-04T11:48:45.013Z
@Sirko might be worth a look into it...
ItamarG3
CC BY-SA 3.0
2017-09-04T12:38:36.587Z
Actually a search, google:"jsp alternative" gives some options.
Buffy
CC BY-SA 3.0
2017-09-04T14:40:14.137Z
Be sure to go for AngularJS first not Angular (Angular is a rewrite of AngularJS in Typescript), the eco system of Angular is quite different and your student will get lost into it. Binding one controller and a ng-repeat to list data loaded from the server should be like 10 line of HTML and 10 of Javascript. Of course if you want them writing a full application, you will have a bit more of work because you will have an MVC on the backend (spring with REST as the view) and on the frontend. Velocity even if not maintened anymore is a good template engine too for backend generation.
Walfrat
CC BY-SA 3.0
2017-09-05T17:20:23.947Z
Why not use servlets instead of (or in additin to) JSP?
Kevin Workman
CC BY-SA 3.0
2017-10-01T13:29:37.110Z
Today it is considered a bad idea to generate HTML on the server before displaying it to client. The typical process involves generating only the data required to render the page, but have the page enough JavaScript to be able to render those data. So, teaching students to deal with JSP or the likes of it would only make sense if they were prepared to support legacy systems.
wvxvw
CC BY-SA 4.0
2018-07-23T18:33:53.353Z
JSP is still a fallback technology, but is quickly being displaced by cleaner frameworks such as Angular backed by spring webservices, as @Sirko mentions. I'm not convinced it's easier, but it results in cleaner separation of concerns and thus cleaner code.
pojo-guy
<java><web-development><language-choice>
Choosing Java-like language for teaching web development
# Choosing Java-like language for teaching web development

(Asked by: username_0 on 2017-09-04)

I just started teaching an introduction to web development to high school students (they have the most basic knowledge of java) and this year my school has decided to make a change in the curriculum.

Previously we used JSP to dynamically generate pages, but now we decided to look for a different technology to replace JSP.

So, I am looking for a language for dynamically generating webpages (again, a replacement for what JSP does: servlets in Java). Bearing in mind that they know a bit of java, it would be highly preferable to use a language that is similar to Java.

I am well aware that there might not be a Java like language for this (other than JSP), but the more the language is similar to Java, the better.

If they end up learning a new language (not necessarily one for dynamic webpage generation), all the better.

**Tags:** java, web-development, language-choice

> **Comments:**
> **username_1**: Are you after creating dynamically generated pages, or dynamic pages? (The latter being pages with code embedded in them. So that the page can run code and change it self, without talking to the server.)  
> **username_0**: @username_1 edited to clear that part.  
> **username_1**: Is javascript close enough? If so then I would suggest you look at couchdb.  
> **username_2**: Why do you want to move away from Java? The reasons might change the answers as well.  
> **username_0**: @username_2 It's not Java I'm running from; it's JSP specifically.  
> **username_2**: Then maybe turn towards a more client focused architecture like Angular in the frontend and Spring for Rest services in the backend. Not sure, however, how suitable this is for high schools students.  
> **username_0**: @username_2 might be worth a look into it...  
> **username_3**: Actually a search, google:"jsp alternative" gives some options.  
> **username_4**: Be sure to go for AngularJS first not Angular (Angular is a rewrite of AngularJS in Typescript), the eco system of Angular is quite different and your student will get lost into it. Binding one controller and a ng-repeat to list data loaded from the server should be like 10 line of HTML and 10 of Javascript. Of course if you want them writing a full application, you will have a bit more of work because you will have an MVC on the backend (spring with REST as the view) and on the frontend. Velocity even if not maintened anymore is a good template engine too for backend generation.  
> **username_5**: Why not use servlets instead of (or in additin to) JSP?  
> **username_6**: Today it is considered a bad idea to generate HTML on the server before displaying it to client. The typical process involves generating only the data required to render the page, but have the page enough JavaScript to be able to render those data. So, teaching students to deal with JSP or the likes of it would only make sense if they were prepared to support legacy systems.  
> **username_7**: JSP is still a fallback technology, but is quickly being displaced by cleaner frameworks such as Angular backed by spring webservices, as @username_2 mentions. I'm not convinced it's easier, but it results in cleaner separation of concerns and thus cleaner code.  

---

## 2 answers

### Answer by username_8 on 2017-09-04. Score: 4

I would recommend:

1. Starting by teaching students just plain HTML, CSS, and perhaps JavaScript and focus on teaching the frontend first.
2. Once students are ready for the backend, switch to using a *minimalist* framework such as [Spark](http://sparkjava.com/). Have them first construct HTML using plain old string concatenation, make a big deal over how sucky that is, then switch to using a [templating engine](http://sparkjava.com/documentation#views-and-templates) (any one will do, so it's probably best to pick one with the best documentation).

Teaching the front-end first does require you to make a "clean break" and switch away from Java, but I do think it's for the best for several reasons:

1. It's essential context for the students to have. Many backend tutorials will assume you already have a good understanding of the frontend, so it'll likely be more confusing if you don't start with the frontend.
2. Starting from the frontend lets students get instant gratification.
3. Starting from the frontend lets you move from simplicity to complexity: you start with static websites and gradually progress to something more complex (dynamic page generation, AJAX hijinkery, etc...).

I like using micro-frameworks such as Spark (for Java) or Flask (for Python) for teaching the backend. There's minimal ceremony, and micro-frameworks tend to closely mirror the HTTP request-response model, minimizing conceptual overhead. And since Spark is Java, you don't need to spend unnecessary time teaching a similar language.

In fact, there's even an argument to be made that the best thing to do is to ditch even micro-frameworks and start with just plain CGI or something: you literally manipulate strings, and that's it. Then, time permitting, you have students write their *own* framework/templating engine/what-have-you on top of that.

Basically, I view web development as one giant exercise in working with abstractions, and I feel one of the best ways to make students understand an abstraction is to have them build it from the ground-up/start without the abstraction. Web frameworks and trends come and go at a ludicrously fast pace, so I think it's particularly important in web development to focus on the fundamentals rather then trends. (You can see more about this philosophy [here](http://www.pgbovine.net/teaching-web-programming.htm))

In particular, I like emphasizing that web frameworks are just complex ways of processing and sending strings: I think it helps demystify a lot of things, and gives students a concrete footing to help build their understanding of these abstractions.

(Tangent: you can work in all kinds of interesting CS topics depending on how much you want to commit to this "build everything yourself" model. For example, you can talk about compilers, parsers, and DSLs if you have students build their own templating engine; you can talk about NFAs, DFAs, regexes and such if you have students build their own regex engine to match routes... This is all probably overkill if your focus is just on teaching web development though.)


---

### Answer by username_9 on 2017-09-04. Score: 4

I would recommend C#, more specifically .NET with MVC.

1. It's fairly straightforward to move from Java to C#, seeing how they are both pretty much the same in terms of usage and maturity as a widely used OOP language.
2. .NET allows you to use controllers + Views + Razor Engine which in turn allow you to use C# to generate most of the web portion i.e. HTML + CSS + JS.

On a related note, the days of programatically generating web code are behind us, now that JS based libraries are becoming ever more powerful. So, I have to opine here that teaching dynamically generating web pages using a Java like language is perhaps not the best step forward. They are better off taking up jQuery (or react if they are Facebook/Instagram fans).

> **Comments:**
> **username_6**: I strongly disagree with the choice of proprietary technology which only really runs on top of another proprietary technology for academic use. (Yes, I know there's open-source version of ASPX and Mono, but they don't really work...) But even if they did, it would be far too easy for students to be led astray and into the non-free world of perpetual hand-holding and hand-twisting performed by large corporations on unsuspecting users.  

---

