Author: remm
Date: Wed Aug 16 05:57:35 2006
New Revision: 431890

URL: http://svn.apache.org/viewvc?rev=431890&view=rev
Log:
- Note: the paths are not completely correct.

Added:
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html   (with props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html   (with 
props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html   (with props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html   (with 
props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html   (with props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html   (with props)
    tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html   (with props)

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,60 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/CookieExample"><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>Source Code for Cookie Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font> 
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> CookieExample <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        
+        <font color="#CC0000">// print out cookies</font>
+
+        Cookie[] cookies = request.getCookies();
+        for (int i = 0; i &lt; cookies.length; i++) {
+            Cookie c = cookies[i];
+            String name = c.getName();
+            String value = c.getValue();
+            out.println(name + &quot;<font color="#009900"> = </font>&quot; + 
value);
+        }
+
+        <font color="#CC0000">// set a cookie</font>
+
+        String name = request.getParameter(&quot;<font 
color="#009900">cookieName</font>&quot;);
+        if (name != null &amp;&amp; name.length() &gt; 0) {
+            String value = request.getParameter(&quot;<font 
color="#009900">cookieValue</font>&quot;);
+            Cookie c = new Cookie(name, value);
+            response.addCookie(c);
+        }
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/cookies.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,49 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/HelloWorldExample"><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>Source Code for HelloWorld Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> HelloWorld <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Hello 
World!&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h1&gt;Hello 
World!&lt;/h1&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/helloworld.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,120 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+   <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+   <meta name="GENERATOR" content="Mozilla/4.61 [en] (WinNT; I) [Netscape]">
+   <meta name="Author" content="Anil K. Vijendran">
+   <title>Servlet Examples</title>
+</head>
+<body bgcolor="#FFFFFF">
+<b><font face="Arial, Helvetica, sans-serif"><font size=+2>Servlet
+Examples with Code</font></font></b>
+<p>This is a collection of examples which demonstrate some of the more
+frequently used parts of the Servlet API. Familiarity with the Java(tm)
+Programming Language is assumed.
+<p>These examples will only work when viewed via an http URL. They will
+not work if you are viewing these pages via a "file://..." URL. Please
+refer to the <i>README</i> file provide with this Tomcat release regarding
+how to configure and start the provided web server.
+<p>Wherever you see a form, enter some data and see how the servlet reacts.
+When playing with the Cookie and Session Examples, jump back to the Headers
+Example to see exactly what your browser is sending the server.
+<p>To navigate your way through the examples, the following icons will
+help:
+<br>&nbsp;
+<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
+<tr VALIGN=TOP>
+<td WIDTH="30"><img SRC="images/execute.gif" ></td>
+
+<td>Execute the example</td>
+</tr>
+
+<tr VALIGN=TOP>
+<td WIDTH="30"><img SRC="images/code.gif" height=24 width=24></td>
+
+<td>Look at the source code for the example</td>
+</tr>
+
+<tr VALIGN=TOP>
+<td WIDTH="30"><img SRC="images/return.gif" height=24 width=24></td>
+
+<td>Return to this screen</td>
+</tr>
+</table>
+
+<p>Tip: To see the cookie interactions with your browser, try turning on
+the "notify when setting a cookie" option in your browser preferences.
+This will let you see when a session is created and give some feedback
+when looking at the cookie demo.
+<br>&nbsp;
+<table BORDER=0 CELLSPACING=5 WIDTH="85%" >
+<tr VALIGN=TOP>
+<td>Hello World</td>
+
+<td VALIGN=TOP WIDTH="30%"><a href="servlet/HelloWorldExample"><img 
SRC="images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/HelloWorldExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="helloworld.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a 
href="helloworld.html">Source</a></td>
+</tr>
+
+<tr VALIGN=TOP>
+<td>Request Info</td>
+
+<td WIDTH="30%"><a href="servlet/RequestInfoExample"><img 
SRC="images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/RequestInfoExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="reqinfo.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a href="reqinfo.html">Source</a></td>
+</tr>
+
+<tr VALIGN=TOP>
+<td>Request Headers</td>
+
+<td WIDTH="30%"><a href="servlet/RequestHeaderExample"><img 
SRC="images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/RequestHeaderExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="reqheaders.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a 
href="reqheaders.html">Source</a></td>
+</tr>
+
+<tr VALIGN=TOP>
+<td>Request Parameters</td>
+
+<td WIDTH="30%"><a href="servlet/RequestParamExample"><img 
SRC="images/execute.gif" HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/RequestParamExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="reqparams.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a 
href="reqparams.html">Source</a></td>
+</tr>
+
+<tr VALIGN=TOP>
+<td>Cookies</td>
+
+<td WIDTH="30%"><a href="servlet/CookieExample"><img SRC="images/execute.gif" 
HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/CookieExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="cookies.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a href="cookies.html">Source</a></td>
+</tr>
+
+<tr VALIGN=TOP>
+<td>Sessions</td>
+
+<td WIDTH="30%"><a href="servlet/SessionExample"><img SRC="images/execute.gif" 
HSPACE=4 BORDER=0  align=TOP></a><a 
href="servlet/SessionExample">Execute</a></td>
+
+<td WIDTH="30%"><a href="sessions.html"><img SRC="images/code.gif" HSPACE=4 
BORDER=0 height=24 width=24 align=TOP></a><a 
href="sessions.html">Source</a></td>
+</tr>
+</table>
+
+<p>Note: The source code for these examples does not contain all of the
+source code that is actually in the example, only the important sections
+of code. Code not important to understand the example has been removed
+for clarity.
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/index.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,48 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestHeaderExample"><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>Source Code for RequestHeader Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font>
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestHeaderExample <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        Enumeration e = request.getHeaderNames();
+        while (e.hasMoreElements()) {
+            String name = (String)e.nextElement();
+            String value = request.getHeader(name);
+            out.println(name + &quot;<font color="#009900"> = </font>&quot; + 
value);
+        }
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqheaders.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,67 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestInfoExample"><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>Source Code for Request Info Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font> 
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestInfo <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Request 
Information Example&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h3&gt;Request Information 
Example&lt;/h3&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Method: </font>&quot; + 
request.getMethod());
+        out.println(&quot;<font color="#009900">Request URI: </font>&quot; + 
request.getRequestURI());
+        out.println(&quot;<font color="#009900">Protocol: </font>&quot; + 
request.getProtocol());
+        out.println(&quot;<font color="#009900">PathInfo: </font>&quot; + 
request.getPathInfo());
+        out.println(&quot;<font color="#009900">Remote Address: </font>&quot; 
+ request.getRemoteAddr());
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+
+<font color="#FF0000">    /**
+     * We are going to perform the same operations for POST requests
+     * as for GET methods, so this method just sends the request to
+     * the doGet method.
+     */</font>
+
+    <font color="#0000FF">public void</font> doPost(HttpServletRequest 
request, HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        doGet(request, response);
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqinfo.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,77 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/RequestParamExample"><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>Source Code for Request Parameter Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font> 
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> RequestParamExample <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        out.println(&quot;<font color="#009900">&lt;html&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;title&gt;Request 
Parameters Example&lt;/title&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/head&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;h3&gt;Request Parameters 
Example&lt;/h3&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Parameters in this 
request:&lt;br&gt;</font>&quot;);
+        if (firstName != null || lastName != null) {
+            out.println(&quot;<font color="#009900">First Name:</font>&quot;);
+            out.println(&quot;<font color="#009900"> = </font>&quot; + 
HTMLFilter.filter(firstName) + &quot;<font 
color="#009900">&lt;br&gt;</font>&quot;);
+            out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
+            out.println(&quot;<font color="#009900"> = </font>&quot; + 
HTMLFilter.filter(lastName));
+        } else {
+            out.println(&quot;<font color="#009900">No Parameters, Please 
enter some</font>&quot;);
+        }
+        out.println(&quot;<font color="#009900">&lt;P&gt;</font>&quot;);
+        out.print(&quot;<font color="#009900">&lt;form action=\"</font>&quot;);
+        out.print(&quot;<font color="#009900">RequestParamExample\" 
</font>&quot;);
+        out.println(&quot;<font color="#009900">method=POST&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">First Name:</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input type=text size=20 
name=firstname&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">Last Name:</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input type=text size=20 
name=lastname&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;br&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;input 
type=submit&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/form&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/body&gt;</font>&quot;);
+        out.println(&quot;<font color="#009900">&lt;/html&gt;</font>&quot;);
+    }
+
+    <font color="#0000FF">public void</font> doPost(HttpServletRequest 
request, HttpServletResponse res)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        doGet(request, response);
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/reqparams.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html
URL: 
http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html?rev=431890&view=auto
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html (added)
+++ tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html Wed Aug 16 
05:57:35 2006
@@ -0,0 +1,69 @@
+<!--
+  Copyright 2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<html>
+<head>
+<title>Untitled Document</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+</head>
+
+<body bgcolor="#FFFFFF">
+<p><font color="#0000FF"><a href="servlet/SessionExample"><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>Source Code for Session Example<font color="#0000FF"><br>
+  </font> </h3>
+<font color="#0000FF"></font> 
+<pre><font color="#0000FF">import</font> java.io.*;
+<font color="#0000FF">import</font> java.util.*;
+<font color="#0000FF">import</font> javax.servlet.*;
+<font color="#0000FF">import</font> javax.servlet.http.*;
+
+<font color="#0000FF">public class</font> SessionExample <font 
color="#0000FF">extends</font> HttpServlet {
+
+    <font color="#0000FF">public void</font> doGet(HttpServletRequest request, 
HttpServletResponse response)
+    <font color="#0000FF">throws</font> IOException, ServletException
+    {
+        response.setContentType(&quot;<font 
color="#009900">text/html</font>&quot;);
+        PrintWriter out = response.getWriter();
+        
+        HttpSession session = request.getSession(true);
+
+        <font color="#CC0000">// print session info</font>
+
+        Date created = new Date(session.getCreationTime());
+        Date accessed = new Date(session.getLastAccessedTime());
+        out.println(&quot;<font color="#009900">ID </font>&quot; + 
session.getId());
+        out.println(&quot;<font color="#009900">Created: </font>&quot; + 
created);
+        out.println(&quot;<font color="#009900">Last Accessed: </font>&quot; + 
accessed);
+
+        <font color="#CC0000">// set session info if needed</font>
+
+        String dataName = request.getParameter(&quot;<font 
color="#009900">dataName</font>&quot;);
+        if (dataName != null &amp;&amp; dataName.length() &gt; 0) {
+            String dataValue = request.getParameter(&quot;<font 
color="#009900">dataValue</font>&quot;);
+            session.setAttribute(dataName, dataValue);
+        }
+
+        // print session contents
+
+        Enumeration e = session.getAttributeNames();
+        while (e.hasMoreElements()) {
+            String name = (String)e.nextElement();
+            String value = session.getAttribute(name).toString();
+            out.println(name + &quot; <font color="#009900">= </font>&quot; + 
value);
+        }
+    }
+}</pre>
+</body>
+</html>

Propchange: tomcat/tc6.0.x/trunk/webapps/examples/servlets/sessions.html
------------------------------------------------------------------------------
    svn:eol-style = native



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to