Exercises, examples and other material relating to training module J907. This topic is presented on public courses Learning to Program in Java
, Java Bootcamp
, Java Programming for the Web
A Java Server Page is a web page with embedded tags that call up Java classes. It can also contain Java source code, to be compiled and run when the page is accessed.
|Articles and tips on this subject||updated|
|3997||Servlet v JSP (Java Server Page). What is the difference?|
A servlet is a web program that generates output (normally HTML) and returns it to a browser.
A JSP (Java Server Page) is a page of HTML ... with some extra bits of code where programatic elements are added as it's returned to the browser
So on the surface, it looks like there's a fundamental difference. ...
|3046||Java Beans, tag libraries and JSPs - what and why.|
Java Programming - training course! - just completed. We went a long way from the first steps in Java on Monday through to Servlets and Java Server Pages (JSPs) on Friday - and yet in many ways, our course goes full circle. For, through Java Server Pages, you can keep the look and feel of a web site ...
|1050||The HTML++ Metalanguage|
What's the difference between a language and a metalanguage?
A language is a single specification - a way of describing a series of actions or how some particular data is handled. Whereas a metalanguage is a way of specifying a series of languages to a particular pattern.
An example? HTML is a language. ...
|2525||Using JSPs, Tag Libraries, Java Beans, Tomcat in one short example|
I've just completed a Java Bootcamp Course. On Tuesday morning, I had newcomers to Java (but with prior programming experience) and by the end of Friday afternoon, they had written some good exercises, using the fundamentals of Java, including Utility classes, and they had also worked with and understood ...
|2183||Servlet life cycle, and Java Servlet variable scope|
If you write a 'traditional' program and run it ... then it is cleared from memory when you finish running it. It does its job then exits. And so it is with a java program that you run from the command line under the java command.
But if you're running a web server, where lots of users all call up ...
|2151||What is a JSP tag library?|
Java programming is very different to writing HTML - web page authors expect a tag based language ... so why not provide one that provides some Java functionality? That's what tag libraries do. My slide shows a piece of Java program - defining a variable and calling a constructor; it's a pretty common ...
|2147||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 ...
|1550||Java (JSP and Servlet examples) live on our server|
On our Java Programming for the Web and Deploying Apache httpd and Tomcat courses, we provide a ready-written demonstration that includes simple web pages, a basic JSP, JSPs with tag libraries, and a couple of Servlets - with some calling up data from a MySQL database.
I have uploaded the examples so ...
|79||Last day of Java|
Friday, last day of "Java Programming for the Web". An exhilarating week with 3 keen students ... both old friends from "way back" and newcomers too. Would have been nice to have one or two more on this course (for purely commercial reasons ;-) ) but it's worked very well. With a Java course, I always ...
Examples from our training material
|Book.java|| net.wellho.Book class - Java Bean to look up on MySQL database|
|Store6.java|| Store class, used to maintain state in JSP demo |
|Tconv.java|| Class for use from JSP using standard tag library|
|bookjava.jsp|| Replacing Java Source code with Tags - some equivalents|
|boxes.jsp|| JSP / Tag Library / Java Bean - the JSP part|
|counter.jsp|| Sessions in a JSP|
|course.jsp|| Simple JSP, displaying a calculation in a page|
|gje2.jsp|| JSP example - Java separated from HTML|
|gje3.jsp|| JSP - Form input and validation|
|graham.jsp|| Hello JSP world|
|index.jsp|| A Shopping cart JSP that maintains state |
|lovely.jsp|| JSP example linking a series of pages, good practise shown|
|products.txt|| Product data for Shopping cart demo|
|rep_aut_2.jsp|| Web -> Tomcat -> JSP -> Tag Library -> MySQL - booklookup|
|report_author.jsp|| Web -> Tomcat -> JSP -> MySQL - booklookup|
|tcform.html|| Form to read a temperature in degrees F|
|tcvt.jsp|| JSP to read temperature in C and convert to F|
|web.xml|| Session timeout changed to 120 minutes |
PicturesDesigning an application in a JSP
This module is available under an Open Training Notes License
for free download from http://www.training-notes.co.uk
Topics covered in this module
The structure of a JSP Page.
What basics can I put in my HTML?.
Entering data into a form.
What happens to the form data?.
What happens next?.
How To Create a Form.
A Simple Hello Application.
Constructing the HTML Form.
Using the GET and POST Methods.
Writing the Bean.
Getting Data From the Form to the Bean.
Checking the Request Object.
Getting data from the Bean to the JSP Page.
How to run the example.
Using scripting elements.
How to add scripting.
The difference between <%, <%=, and <%!.
The Number Guess Game.
Using Scripting Elements in a JSP File.
Mingling scripting elements with tags.
When are the scripting elements executed?.
How to run the example.
A JSP that maintains state.
If you are looking for a complete course and not just a information on a single subject, visit our Listing and schedule
Well House Consultants specialise in training courses in
. We run
throughout the UK (and beyond for longer courses), and
at our training centre in Melksham, Wiltshire, England.
It's surprisingly cost effective to come on our public courses -
even if you live in a different
country or continent to us
We have a technical library of over 700 books on the subjects on which we teach.
These books are available for reference at our training centre. Also
available is the Opentalk
Forum for discussion of technical questions.