Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
 
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
A very easy JSP (Java Server Page)

"Can you give me an easy first example" ... a common question on a course and - yes, I usually can. And so can other tutors. But then they go on and add things to make them complicated. So here is a really easy JSP example!

JSP is what I call an "HTML++ language" ... you write the HTML of the web page and you embed, within it, extra code of a sort that the browser wouldn't understand. Then you add a filter on your web server telling it to identify these extra codes (tags) and perform the instructions they contain.

Here is the HTML++ code ...

<% int wide = 5; int deep = 3;
int spaces = wellho.Utils.mully(wide, deep); %>
<html>
<head>
<title>Laptops I have poured coffee over</title>
</head>
<body>
<h1>This is my web page</h1>
You have room for
<%= spaces %> laptops
<hr>
Copyright etc
</body>
</html>


... and here is the result of running it, as received by my browser ...

<html>
<head>
<title>Laptops I have poured coffee over</title>
</head>
<body>
<h1>This is my web page</h1>
You have room for
13 laptops
<hr>
Copyright etc
</body>
</html>


The original code from <% to %> is Java statements that the web server runs, and the code from <%= to %> is a Java expression which is worked out, cast to a string, and output.

To complete the example, I chose to call a method in another java class (wellho.Utils.mully) to perform my calculations - it's representative of the work that goes on (business logic) behing my web page. Here's the source code that defined it:

package wellho;
public class Utils {
public static int mully(int dis, int dat) {
  int wesult = dis * dat -2;
  return wesult;
  }
}


We've just scheduled - at short notice - two extra Java courses for May. Learning to program in Java from 11th and Java Bootcamp which starts a day later for those with prior programming experience. As this is a very late offering, you could twist my arm to give you five days for the price of four, or four days for the price of three. And the groups size will be 'just a handful' so there will be a superb tutor to student ratio to ensure that every delegate gets a lot from the course.
(written 2009-05-01)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
J907 - JSP - JavaServer Pages
  [79] Last day of Java - (2004-10-08)
  [1050] The HTML++ Metalanguage - (2007-01-22)
  [1550] Java (JSP and Servlet examples) live on our server - (2008-02-23)
  [2151] What is a JSP tag library? - (2009-05-01)
  [2183] Servlet life cycle, and Java Servlet variable scope - (2009-05-16)
  [2525] Using JSPs, Tag Libraries, Java Beans, Tomcat in one short example - (2009-12-04)
  [3046] Java Beans, tag libraries and JSPs - what and why. - (2010-11-13)
  [3997] Servlet v JSP (Java Server Page). What is the difference? - (2013-02-06)

J607 - Java - Servlets, JSP, Tomcat
  [1766] Diagrams to show you how - Tomcat, Java, PHP - (2008-08-22)
  [2058] Invoker and cgi servlets on Tomcat 6 - (2009-02-27)
  [2642] What does a web application look like under Tomcat? - (2010-02-20)


Back to
An evening excursion to Devizes and Avebury
Previous and next
or
Horse's mouth home
Forward to
Variable scope in Java Servlets and other web applications
Some other Articles
Routers, Firewalls and multilayer servers
Routing Network Traffic - Proxies, Redirects and DNS
Variable scope in Java Servlets and other web applications
A very easy JSP (Java Server Page)
An evening excursion to Devizes and Avebury
Using the internet to remotely check for power failure at home (PHP)
Looking for a career change - Physician to Web Site Designer
Throughout the year, around the world
Riverside Development
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2021: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2147_A-v ... Page-.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb