Category: FromSitesTree.com

PrimeExample.jsp Page that uses the PrimeTag custom tag #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

PrimeExample.jsp Page that uses the PrimeTag custom tag <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Illustration of PrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>Some N-Digit Primes</TITLE> <LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css"> </HEAD> <BODY> <H1>Some …

Continue reading

HeadingTag.java Custom tag that makes use of a tag body #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

HeadingTag.java Custom tag that makes use of a tag body package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Generates an HTML heading with the specified background * color, foreground color, alignment, font, and font size. * You can also turn on a border around it, which normally * just barely encloses the heading, but …

Continue reading

SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

SimplePrimeExample.jsp Page that uses the SimplePrimeTag custom tag <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Illustration of SimplePrimeTag tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <TITLE>Some 50-Digit Primes</TITLE> <LINK REL=STYLESHEET HREF="JSP-Styles.css" TYPE="text/css"> </HEAD> <BODY> <H1>Some …

Continue reading

PrimeTag.java Custom tag that outputs a random prime number of a user-specifiable approximate length #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

PrimeTag.java Custom tag that outputs a random prime number of a user-specifiable approximate length package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Generates an N-digit random prime (default N = 50). * Extends SimplePrimeTag, adding a length attribute * to set the size of the prime. The doStartTag * method of the parent class …

Continue reading

SharedCounts1.jsp, SharedCounts2.jsp, and SharedCounts3.jsp Three pages that all use the AccessCountBean. Results you get depend on which page is hit first and how many total hits the combined pages receive. #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

SharedCounts1.jsp, SharedCounts2.jsp, and SharedCounts3.jsp Three pages that all use the AccessCountBean. Results you get depend on which page is hit first and how many total hits the combined pages receive. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Example of sharing beans. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun …

Continue reading

ExampleTag.java Very simple custom tag. Remember to install it in the WEB-INF/classes/cwp/tags directory. #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

ExampleTag.java Very simple custom tag. Remember to install it in the WEB-INF/classes/cwp/tags directory. package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; /** Very simple JSP tag that just inserts a string * ("Custom tag example…") into the output. * The actual name of the tag is not defined here; * that is given by the …

Continue reading

cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

cwp-taglib.tld Tag Library Descriptor file used by the custom tags in this chapter. <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"> <!– a tag library descriptor –> <taglib> <!– after this the default space is "http://java.sun.com/j2ee/dtds/jsptaglibrary_1_2.dtd" –> <tlibversion>1.0</tlibversion> <jspversion>1.1</jspversion> <shortname>cwp</shortname> <!– ** CHANGED FROM "urn" TO "uri" IN …

Continue reading

SimpleExample.jsp Page that uses the ExampleTag custom tag. #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

SimpleExample.jsp Page that uses the ExampleTag custom tag. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!– Illustration of very simple JSP custom tag. Taken from Core Web Programming Java 2 Edition from Prentice Hall and Sun Microsystems Press, . May be freely used or adapted. –> <HTML> <HEAD> <%@ taglib uri="cwp-taglib.tld" prefix="cwp" %> <TITLE><cwp:example /></TITLE> …

Continue reading

SimplePrimeTag.java Custom tag that outputs a random prime number of a fixed approximate length #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

SimplePrimeTag.java Custom tag that outputs a random prime number of a fixed approximate length package cwp.tags; import javax.servlet.jsp.*; import javax.servlet.jsp.tagext.*; import java.io.*; import java.math.*; import cwp.*; /** Generates a prime of approximately 50 digits. * (50 is actually the length of the random number * generated — the first prime above that number will * …

Continue reading

SaleEntry.java Bean used to demonstrate the various approaches to reading request parameters and stuffing them into Java objects. #Programming Code Examples #Java/J2EE/J2ME #Applets and Basic Graphics

package cwp; /** Simple bean to illustrate the various forms * of jsp:setProperty. * <P> * Taken from Core Web Programming Java 2 Edition * from Prentice Hall and Sun Microsystems Press, * . * May be freely used or adapted. */ public class SaleEntry { private String itemID = "unknown"; private double discountCode = …

Continue reading