Tag: code

ShowMessage.java Servlet that demonstrates the use of initialization parameters.

ShowMessage.java  Servlet that demonstrates the use of initialization parameters. Remember that, to use this servlet, you have to do three things:     * Put the modified web.xml file in the WEB-INF directory.     * Restart the server.     * Use the registered servlet name (i.e., the URL http://host/servlet/ShowMsg), not the raw servlet name (i.e., the …

Continue reading

ServletUtilities.java Utility class that simplifies the output of the DOCTYPE and HEAD in servlets, among other things. Used by most remaining servlets in the chapter.

ServletUtilities.java  Utility class that simplifies the output of the DOCTYPE and HEAD  in servlets, among other things. Used by most remaining servlets in the chapter. package cwp; import javax.servlet.*; import javax.servlet.http.*; /** Some simple time savers. Note that most are static methods.  *    *  Taken from Core Web Programming Java 2 Edition  *  from …

Continue reading

SimplerHelloWWW.java Servlet that uses ServletUtilities to simplify the generation of the DOCTYPE and HEAD part of the servlet.

SimplerHelloWWW.java  Servlet that uses ServletUtilities  to simplify the generation of the DOCTYPE and HEAD part of the servlet. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that generates HTML. This variation of  *  HelloWWW uses the ServletUtilities utility class  *  to generate the DOCTYPE, HEAD, and TITLE.  *    *  Taken from …

Continue reading

HelloWWW.java Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory.

HelloWWW.java  Servlet that generates HTML. This and all remaining servlets are in the cwp package and therefore should be installed in the cwp subdirectory. package cwp; import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Simple servlet that generates HTML.  *    *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun …

Continue reading

ServletTemplate.java Starting point for servlets.

ServletTemplate.java Starting point for servlets. import java.io.*; import javax.servlet.*; import javax.servlet.http.*; /** Servlet template.  *    *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press,  *  .  *  May be freely used or adapted.  */ public class ServletTemplate extends HttpServlet {   public void doGet(HttpServletRequest request,                     …

Continue reading

StringBean.java Bean used to demonstrate jsp:useBean, etc. Remember to install it in the WEB-INF/classes/cwp directory.

StringBean.java  Bean used to demonstrate jsp:useBean, etc. Remember to install it in the WEB-INF/classes/cwp directory. package cwp; /** A simple bean that has a single String property  *  called message.  *  <P>  *  Taken from Core Web Programming Java 2 Edition  *  from Prentice Hall and Sun Microsystems Press,  *  .  *  May be freely …

Continue reading

PluginApplet.jsp Page that demonstrates the use of jsp:plugin.

PluginApplet.jsp  Page that demonstrates the use of jsp:plugin. Requires you to compile and install PluginApplet.java, TextPanel.java, DrawingPanel.java, and WindowUtilities.java  Since these are classes sent to the client to used by applets, the .class files should be in the same directory as the JSP page, not in the WEB-INF/classes directory where classes the server uses go. …

Continue reading

BGColor.jsp Page that demonstrates JSP scriptlets. Uses the JSP-Styles style sheet.

BGColor.jsp  Page that demonstrates JSP scriptlets. Uses the JSP-Styles  style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!–     Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD>   <TITLE>Color Testing</TITLE> </HEAD> <% String bgColor = request.getParameter(“bgColor”); boolean …

Continue reading

Excel.jsp Page that demonstrates the use of JSP to build Excel spreadsheets

Excel.jsp  Page that demonstrates the use of JSP to build Excel spreadsheets First    Last    Email Address Marty    Hall    hall@corewebprogramming.com Larry    Brown    brown@corewebprogramming.com Bill    Gates    gates@sun.com Larry    Ellison    ellison@microsoft.com <%@ page contentType=”application/vnd.ms-excel” %> <%– There are tabs, not spaces, between columns. –%>

Expressions.jsp Page that demonstrates JSP expressions. Uses the JSP-Styles style sheet.

Expressions.jsp  Page that demonstrates JSP expressions. Uses the JSP-Styles  style sheet. <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <!– Example of JSP Expressions.     Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>JSP Expressions</TITLE> <META NAME=”keywords”       …

Continue reading