Free Course: Java Programming & Web Sites Using JSP and Servlets


Exercise using Internet subversion server and HelloWorld2 project
Look at the links tab and read about assembla.com, a company in Needham that hosts tools for teams doing distributed programming projects worldwide.

See if you can checkout the HelloWorld2 project and add a println to the main() method that emits "your name was here".

Use the versioning --> subversion tool in the Netbeans IDE. The URL to the subversion server is http://svn2.assembla.com/svn/cdh_learning/

Netbeans should help you get and install the subversion client the first time. If not go to www.collab.net and download the cmd line client. There is one for Windows.

Checkout needs no login and password since this is a free public space. However checkin of your modified code needs my login=chavener and password which I will give out in class or via email.
Exercise creating a Swing GUI using Matisse GUI builder
Create a simple alarm clock GUI with a text field you can enter minutes or seconds and a start button. Have a text field for entering a brief message. As each minute or second passes after start is pressed, decrement the number in the text field. When it reaches zero play a sound several times and pop up a dialog box with the message text. Once start is pressed, the button legend should change to cancel and when pressed the GUI should exit cleanly. When you set the action performed, i.e. you wire up the button, be sure to use the background task version.



You should also change the deafult resource properties of the about box so it has your name etc.



See the link about Swing threading by John Zukowski. John Zukowski on Swing threading and EDT

Another hint: Thread.currentThread().sleep(1000); will pause for one second.

At session three of the course we have not covered the Swing GUI or Java Threads in any detail so this exercise will be a challenge. Try just laying out the GUI first. Later when we have covered more Swing and Threading topics, go back and add the action code.
Exercise creating a web site using Netbeans and Tomcat
Create a web app similar to the course one at www.cdhconsult.com/course. We will be making a signup web app in class step by step and putting it in the subversion repository. Use the css tabs, use tiling as discussed in class using the EL and JSTL and the jsp:include. Create a MySQL DB and create a table to hold the signup form values like name, town, email, etc. Use the dbConnectionBroker for connection pooling in the registration servlet. See the powerpoint links for slides on how to get and install MySQL and tools.
Exercise challenge - add a dynamic Title to the signup web app
The title element in the head section of index.jsp should have a value that depends on the page fragment we will be including using the jsp:include. Can you figure out how to do this using the power we now have with servlets, the EL, etc. Ideally the title would appear in the page fragment source code itself. Can you figure out a way to make that work?
Another signup enhancement project - tile the registration error and success messages
As it stands in class the register servlet returns a new page. make it be tiled. Perhaps put the message in the session object and forward to a tiled JSP that displays the message. You decide how to do it.
Another signup enhancement project - generalize the form validation using bean
Come up with a design for a java package that will facilitate general form validation by extending and enhancing the simple bean validation we did in class. It will have to somehow tie field names to a set of validations such as "not blank","string length bounds", "email address","credit card" etc. Perhaps the bean and it's asscociated list of tests can be passed to a method that will return pass or fail and set the messages in the bean.
Another signup enhancement project - display registrant name and town with his comment in a tab
Access the DB and dynamically make a drop down list or other way of showing the registered people. Selecting a person should show his name, town and comment in a tile page. You might use AJAX or not, the design is up to you.