in reply to while loop with diamond operator

As blue_cowdawg said, Tomcat doesn't support CGI by default. You have to do 3 things:

1. Rename file servlets-cgi.renametojar (under your tomcat servlet directory) to servlets-cgi.jar

2. Modify your web.xml (usually under ../server/default/deploy/conf/) and uncomment whole part arround cgi servlet (don't forget mapping inside same file)

3. Modify context.xml file (usually under ../web.deployer directory) and add privileged="true" in < Context... >line, so it looks something like this <Context cookies="true" crossContext="true" privileged="true">

And that would make CGI work on your Tomcat 5 or 6 server