Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
<!-- Filename %CATALINA_HOME%\conf\web.xml -->
...
<!-- uncomment the cgi servlet in ...\conf\web.xml -->
<servlet>
<servlet-name>cgi</servlet-name>
...
<!-- add this block here so it knows to use 'cmd' instead of 'perl' -->
<init-param>
<param-name>executable</param-name>
<param-value>cmd /q /c</param-value>
</init-param>
...
</servlet>
<!-- uncomment the cgi mapping block as well -->
<!-- filename: %CATALINA_HOME%\conf\server.xml -->
<!-- If not using a webserver, change line ~77 <Connector port"8080" to... -->
...
<Connector port "80"
...
<HTML>
<HEAD>
<!--
filename: %CATALINA_HOME%\webapps\foo\index.jsp
purpose: Test CGI batch file output on WinXP, Tomcat 5.5, no webserver
input: User clicks link(s) to test CGI
output: HTML generated by foo.bat
comments: Probably the ugliest HTML page, but useful...
-->
<% String title = "Foo JSP" %>
<%!
static final String[] foo = {
"/cgi-bin/foo.bat",
"./WEB-INF/cgi/foo.bat",
"foo.bat"
};
%>
<title><%= title %></title>
</HEAD>
<BODY>
<H1><%= title %></H1>
<hr>
<%
for (int bar = 0; bar < foo.length; bar++) {
String bat = foo[bar];
%>
<A HREF="<%= bat %>" TARGET="_self"><%= bat %></A>
<FORM METHOD="POST" ACTION="<%= bat %>"><INPUT TYPE="submit" VALUE="<%= bat %> POST"></FORM>
<HR>
<% } %>
<HR>
</BODY>
</HTML>
:: filename: %CATALINA_HOME%\foo\WEB-INF\cgi\foo.bat
:: purpose: Output HTML via CGI
:: input: None
:: output: Via HTML current time and directory on system
:: comments: No echo off needed if executable includes switch /q
:: Remember to escape special characters with a carot(^)
echo Content-type: text/html
echo.
echo.
echo ^<HTML^>
echo ^<BODY^>
echo ^<H1^>Foo^</H1^>
echo ^<P^>Time is:
time /t
echo ^</P^>
echo ^<P^>Location is:
chdir
echo ^</P^>
echo ^</BODY^>
echo ^</HTML^>
:: filename: %CATALINA_HOME%\foo\WEB-INF\cgi\drag_bat_here.bat
:: purpose: Test .bat file output before using in Tomcat
:: input: Drag foo.bat icon over this file's icon in Windows to test, user
:: must press any key for cmd window to terminate
:: output: What will go into the CGI servlet, but only to a cmd screen for viewing
cmd.exe /q /c "%1"
pause
<?xml versioin="1.0" encoding="ISO-8859-1"?>
<!--
filename: %CATALINA_HOME%\webapps\foo\WEB-INF\web.xml
purpose: Put a viewable title in http://localhost/manager/html
input: None
output: Per xml web-app usage
-->
<web-app>
<display-name>Foo</display-name>
<description>Welcome to Foo</description>
</web-app>