1. Copy txt files to any folder in your system. Make sure that WebServer account have read/write access to that folder.
2. Create servlet with alias "GuestBook" and class name GuestBook in the package Test ( You do not need to actually create it you just need to configure your web server and can take classes from example).
3. Set parameter TemplatePath = Folder where txt files. It must be full paht in your file system. Example: TemlatePath = c:\\Templates\\
If you have chosed another alias you will need to change it in config.txt file.
Make devtemplates.jar available for JVM. Usually you need to set class path for that. It's a development edition of "Template" package. It compiles templates every time regardles were they previously compiled or not. So you can change txt file and do not need to delete cml ( compiled template) file. Note that for changes in config.txt you will need to restart servlet. Please do not do any performance tests with development version. If you would like to do performance test please submit request on http://template.da.ru
Test servlet http://youwebserver/servlet/guestbook/viewguest
Please note how we did validation for input fields on addguest form. In input.txt (template for this page ) look for <input type="text" name="First" size="20" validtype="s1,20" helpword="First name">. Just because everything is an object (input type="text" is a HtmlText object)it can validate itself.
If you get it to work you can play with templates file. Change body in config.txt or create your own tag say color="red" and in guestbook.txt somewhere write <font color="@color@"> BLABLALBA</font>. But do not forget to restart servlet. Or if you want first name centred in the table you only need to change in guestbook.txt <td width="20%" name="First"></td> to <td width="20%" name="First" align="center"></td> ( you do not need to restart servlet in this case)
Troubleshooting:
1. No output to browser. - Check you error log. If you see there file name "viewguest.txt" it means tepmlate package can not access to viewguest.txt. It could be permission problem ( you need read/write access to folder and read access to file ). Or wrong configurational settings for servlet. Check TemplatePath.
2. Only first page is visible and link does not work. - Check config.txt file. ServletPath must be set to GuestBook servlet. Pay attention it's case sensitive.
If you have any problem or question please submit your question on http://template.da.ru