Hi there,

I sent a patch to display the source code in the JSP examples and did not
get any feedback either. Probably because US folk was in turkey mode :) and
busy working on Tomcat 3.2 thereafter. Good work!!

What it does:
JSP Examples in Tomcat 4.0 have a 'View Source' button. All but the
numberguess example do execute the JSP instead of displaying the source. My
patches do use source.jsp to display the sources instead of referencing the
*.txt files.

The attatched zip file contains my current webapp\examples\jsp directory
tree without the noe unnecessary *.txt files.

Most of the example code should be reusable in Tomcat 3.X


Please let me know, if this is usefull or not

I resend the patch as attatchment.

Best regards,
Hans



I had no luck putting this Bug into Bugrat:
Error: 500
Location: /BugRatReport/PostReport
Internal Servlet Error:

java.lang.NoClassDefFoundError: javax/activation/DataSource
        at org.gjt.bugrat.servlet.BugRatReport.processReportPOST(Compiled Code)
        at org.gjt.bugrat.servlet.BugRatReport.doPost(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at org.apache.tomcat.core.ServletWrapper.doService(Compiled Code)
        at org.apache.tomcat.core.Handler.service(Compiled Code)
        at org.apache.tomcat.core.ServletWrapper.service(Compiled Code)
        at org.apache.tomcat.core.ContextManager.internalService(Compiled Code)
        at org.apache.tomcat.core.ContextManager.service(Compiled Code)
        at
org.apache.tomcat.service.connector.Ajp12ConnectionHandler.processConnection
(Compiled Code)
        at org.apache.tomcat.service.TcpWorkerThread.runIt(Compiled Code)
        at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(Compiled Code)
        at java.lang.Thread.run(Compiled Code)


Here the entry:

JSP Examples in Tomcat 4.0 have a 'Source' button. All but the numberguess
example do execute the JSP instead of displaying the source. My patch uses
source.jsp to display the sources instead of referencing the *.txt files.

I will repost a patch in the tomcat-dev list, which corrects this behavior
for Tomcat 4.0

But the Tomcat 3.2 examples look pretty much the same.

I am using Tomcat 4.0 and 3.2 in standalone mode

http://localhost:8080 then press JSP Examples.
Click 'Sorce' on the Numberguess line, then 'Source Code for...'

you get the source code displayed.

For all other examples, the JSP page gets executed.

cvs diff -u (in directory 
D:\Develop\jakarta-cvs\jakarta-tomcat-4.0\webapps\examples\jsp)
cvs server: Diffing .
Index: index.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/index.html,v
retrieving revision 1.1
diff -u -r1.1 index.html
--- index.html  2000/08/17 00:58:03     1.1
+++ index.html  2000/11/23 14:55:51
@@ -6,7 +6,7 @@
    <meta name="Author" content="Anil K. Vijendran">
    <title>JSP Examples</title>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 </head>
@@ -90,7 +90,7 @@
 
 <td VALIGN=TOP WIDTH="30%"><a href="/checkbox/check.html"><img 
SRC="../images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a><a 
href="checkbox/check.html">Execute</a></td>
 
-<td WIDTH="30%"><a href="colors/cresult.html"><img SRC="../images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a 
href="checkbox/cresult.html">Source</a></td>
+<td WIDTH="30%"><a href="checkbox/cresult.html"><img SRC="../images/code.gif" 
+HSPACE=4 BORDER=0 height=24 width=24 align=TOP></a><a 
+href="checkbox/cresult.html">Source</a></td>
 </tr>
 
 <tr VALIGN=TOP>
cvs server: Diffing cal
cvs server: cannot find cal/cal1.txt
cvs server: cannot find cal/cal2.txt
Index: cal/calendar.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/cal/calendar.html,v
retrieving revision 1.1
diff -u -r1.1 calendar.html
--- cal/calendar.html   2000/08/17 00:58:04     1.1
+++ cal/calendar.html   2000/11/23 14:55:53
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -13,9 +13,9 @@
 <p><font color="#0000FF"><a href="login.html"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
 <h2> Source Code for Calendar Example. <br>
-<h3><a href="cal1.txt">cal1.jsp<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/cal/cal1.jsp">cal1.jsp<font 
+color="#0000FF"></a>
   </font> </h3>
-<h3><a href="cal2.txt">cal2.jsp<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/cal/cal2.jsp">cal2.jsp<font 
+color="#0000FF"></a>
   </font> </h3>
 
 <br>
cvs server: Diffing checkbox
cvs server: cannot find checkbox/checkresult.txt
Index: checkbox/cresult.html
===================================================================
RCS file: 
/home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/checkbox/cresult.html,v
retrieving revision 1.1
diff -u -r1.1 cresult.html
--- checkbox/cresult.html       2000/08/17 00:58:07     1.1
+++ checkbox/cresult.html       2000/11/23 14:55:55
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="check.html"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="checkresult.txt">Source Code for Checkbox Example<font 
color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/checkbox/checkresult.jsp">Source Code for 
+Checkbox Example<font color="#0000FF"></a>
   </font> </h3>
 
 <h3><a href="CheckTest.html">Property Sheet for CheckTest
cvs server: Diffing colors
Index: colors/clr.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/colors/clr.html,v
retrieving revision 1.1
diff -u -r1.1 clr.html
--- colors/clr.html     2000/08/17 00:58:09     1.1
+++ colors/clr.html     2000/11/23 14:55:58
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="colors.html"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="colors.txt">Source Code for Color Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/colors/colrs.jsp">Source Code for Color 
+Example<font color="#0000FF"></a>
   </font> </h3>
 
 <h3><a href="ColorGameBean.html">Property Sheet for ColorGameBean
cvs server: cannot find colors/colors.txt
cvs server: Diffing dates
Index: dates/date.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/dates/date.html,v
retrieving revision 1.1
diff -u -r1.1 date.html
--- dates/date.html     2000/08/17 00:58:09     1.1
+++ dates/date.html     2000/11/23 14:55:59
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="date.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="date.txt">Source Code for Date Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/dates/date.jsp">Source Code for Date 
+Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find dates/date.txt
cvs server: Diffing error
Index: error/er.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/error/er.html,v
retrieving revision 1.1
diff -u -r1.1 er.html
--- error/er.html       2000/08/17 00:58:10     1.1
+++ error/er.html       2000/11/23 14:56:02
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="error.html"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="err.txt">Source Code for Error Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/error/err.jsp">Source Code for Error 
+Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find error/err.txt
cvs server: Diffing forward
cvs server: cannot find forward/forward.txt
Index: forward/fwd.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/forward/fwd.html,v
retrieving revision 1.1
diff -u -r1.1 fwd.html
--- forward/fwd.html    2000/10/16 21:33:11     1.1
+++ forward/fwd.html    2000/11/23 14:56:04
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 <head>
@@ -11,7 +11,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="forward.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="forward.txt">Source Code for Forward Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/forward/forward.jsp">Source Code for 
+Forward Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: Diffing include
Index: include/inc.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/include/inc.html,v
retrieving revision 1.1
diff -u -r1.1 inc.html
--- include/inc.html    2000/08/17 00:58:12     1.1
+++ include/inc.html    2000/11/23 14:56:07
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 <head>
@@ -11,7 +11,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="include.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="include.txt">Source Code for Include Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/include/include.jsp">Source Code for 
+Include Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find include/include.txt
cvs server: Diffing jsptoserv
Index: jsptoserv/jts.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/jsptoserv/jts.html,v
retrieving revision 1.1
diff -u -r1.1 jts.html
--- jsptoserv/jts.html  2000/08/17 00:58:14     1.1
+++ jsptoserv/jts.html  2000/11/23 14:56:09
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,10 +12,10 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="jsptoservlet.jsp"><img 
src="../../images/execute.gif" align="right" border="0"></a><a 
href="../index.html"><img src="../../images/return.gif" width="24" height="24" 
align="right" border="0"></a></font></p>
 
-<h3><a href="jts.txt">Source Code for JSP calling servlet <font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/jsptoserv/jsptoservlet.jsp">Source Code 
+for JSP calling servlet <font color="#0000FF"></a>
   </font> </h3>
 
-<h3><a href="stj.txt">Source Code for Servlet calling JSP 
+<h3><a href="stj.txt">Source Code for Servlet calling JSP
 <font color="#0000FF"></a> </font> </h3>
 
 </body>
cvs server: cannot find jsptoserv/jts.txt
cvs server: Diffing num
cvs server: cannot find num/numguess.txt
cvs server: Diffing plugin
Index: plugin/plugin.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/plugin/plugin.html,v
retrieving revision 1.1
diff -u -r1.1 plugin.html
--- plugin/plugin.html  2000/08/17 00:58:15     1.1
+++ plugin/plugin.html  2000/11/23 14:56:12
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 <head>
@@ -11,7 +11,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="plugin.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="plugin.txt">Source Code for Plugin Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/plugin/plugin.jsp">Source Code for Plugin 
+Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find plugin/plugin.txt
cvs server: Diffing plugin/applet
cvs server: Diffing security
cvs server: Diffing security/login
cvs server: Diffing security/protected
cvs server: Diffing sessions
cvs server: cannot find sessions/carts.txt
Index: sessions/crt.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/sessions/crt.html,v
retrieving revision 1.1
diff -u -r1.1 crt.html
--- sessions/crt.html   2000/08/17 00:58:18     1.1
+++ sessions/crt.html   2000/11/23 14:56:23
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="carts.html"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="carts.txt">Source Code for Cart Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/sessions/carts.jsp">Source Code for Cart 
+Example<font color="#0000FF"></a>
   </font> </h3>
 
 <h3><a href="DummyCart.html">Property Sheet for DummyCart
cvs server: Diffing simpletag
Index: simpletag/foo.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/simpletag/foo.html,v
retrieving revision 1.1
diff -u -r1.1 foo.html
--- simpletag/foo.html  2000/08/17 00:58:19     1.1
+++ simpletag/foo.html  2000/11/23 14:56:25
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 <head>
@@ -11,7 +11,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="foo.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="foo.txt">Source Code for the Simple Tag Example<font color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/simpletag/foo.jsp">Source Code for the 
+Simple Tag Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find simpletag/foo.txt
cvs server: Diffing snp
Index: snp/snoop.html
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-4.0/webapps/examples/jsp/snp/snoop.html,v
retrieving revision 1.1
diff -u -r1.1 snoop.html
--- snp/snoop.html      2000/08/17 00:58:19     1.1
+++ snp/snoop.html      2000/11/23 14:56:27
@@ -1,6 +1,6 @@
 <html>
 <!--
-  Copyright (c) 1999 The Apache Software Foundation.  All rights 
+  Copyright (c) 1999 The Apache Software Foundation.  All rights
   reserved.
 -->
 
@@ -12,7 +12,7 @@
 <body bgcolor="#FFFFFF">
 <p><font color="#0000FF"><a href="snoop.jsp"><img src="../../images/execute.gif" 
align="right" border="0"></a><a href="../index.html"><img 
src="../../images/return.gif" width="24" height="24" align="right" 
border="0"></a></font></p>
 
-<h3><a href="snoop.txt">Source Code for Request Parameters Example<font 
color="#0000FF"></a>
+<h3><a href="/examples/jsp/source.jsp?/jsp/snp/snoop.jsp">Source Code for Request 
+Parameters Example<font color="#0000FF"></a>
   </font> </h3>
 
 </body>
cvs server: cannot find snp/snoop.txt

*****CVS exited normally with code 1*****

jsp.zip

Reply via email to