/*
* @(#)FooServlet.java 1.21 97/05/22
*
* Copyright (c) 1996-1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
* CopyrightVersion 1.0
*/
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
/**
* This is a simple example of a Bean Servlet
*/
public class BeanServlet extends HttpServlet {
int foo = 0;
String s = null;
float f = 0;
boolean b = false;
String name = null;
String sarray[] = null;
int intArray[] = null;
boolean barray[] = null;
public void doGet (HttpServletRequest req, HttpServletResponse res)
throws ServletException, IOException
{
ServletOutputStream out = res.getOutputStream();
// set content type and other response header fields first
res.setContentType("text/html");
// then write the data of the response
out.println("
BeanServlet Output ");
out.println(" BeanServlet InitArgs read
");
out.println("name = " + getServletName());
out.println("
");
out.println("foo = " + getFoo());
out.println("
");
out.println("barBee = " + getBarBee());
out.println("
");
out.println("bazzBoo = " + getBazzBoo());
out.println("
");
out.println("driftFlow = " + getDriftFlow());
out.println("
");
out.println("intArray = ");
int ia[] = getIntArray();
for (int k = 0; k < ia.length; k++) {
out.println(ia[k]);
}
out.println("
");
out.println("boolArray = ");
boolean ba[] = getBoolArray();
for (int k = 0; k < ba.length; k++) {
out.println(ba[k]);
}
out.println("
");
out.println("stringArray = ");
String sa[] = getStringArray();
for (int k = 0; k < sa.length; k++) {
out.println(sa[k]);
}
out.println("
");
out.println("");
out.close();
}
public String getServletName() {
return name;
}
public void setServletName(String n) {
name = n;
}
public String getServletInfo() {
return "A simple servlet";
}
public int getFoo() {
return foo;
}
public void setFoo(int i) {
foo = i;
}
public String getBarBee() {
return s;
}
public void setBarBee(String x) {
s = x;
}
public boolean getBazzBoo() {
return b;
}
public void setBazzBoo(boolean x) {
b = x;
}
public float getDriftFlow() {
return f;
}
public void setDriftFlow(float x) {
f = x;
}
public boolean[] getBoolArray() {
return barray;
}
public int[] getIntArray() {
return intArray;
}
public String[] getStringArray() {
return sarray;
}
public void setBoolArray(boolean b[]) {
barray = b;
}
public void setIntArray(int i[]) {
intArray = i;
}
public void setStringArray(String s[]) {
sarray = s;
}
}