a | 0 |
b | 1 |
input char | added to dict | output |
---|---|---|
a | ||
a | aa=2 | 0=a |
b | ab=3 | 0=a |
a | ba=4 | 1=b |
a | ||
b | aab=5 | 2=aa |
a | ||
a | baa=6 | 4=ba |
b | ||
. | aab=5 | 3=ab |
div is a generic block display tag and span is a generic inline display tag. They are typically used in conjunction with CSS to format block text and inline text respectively.
The HTTP response header contains a header field "Content-Type" which indicates the MIME type of the data returned in the response body. The MIME type for HTML is "text/html", and that for a JPEG image is "image/jpeg".
IP provides for unique worldwide network addresses and the protocols necessary to bridge different physical networks (hence the name Inter-net). IP, however, sends only small, fixed-size packets of data to a specific computer (not to a specific process running on that computer), may silently drop packets, and may have them arrive in a different order than they were sent. TCP uses IP to implement a reliable (it either works or it sends you an error saying it didn't), infinite byte-stream oriented networking capability that allows for multiple ports that may be read/written by separate processes on a computer.
Probably false. The Web server will typically parse a response header before sending it to the client browser. If it detects a redirect, it may implement it in many ways, including sending the text of the destination page, but this would be unusual. Typically, it would send a page indicating that the requested page has moved and giving the new URL. This is for the benefits of browsers that can't or won't handle the redirect header.
A cookie containing a unique session id is passed to the client browser.
Each time the client comes back to the same server, the cookie containing the
session id is passed back.
Each URL that refers back to other pages on the same server within the same
"web application" is written with a "?" query-string parameter indicating the
unique session id
Each form contains a hidden variable whose value is the unique session id.
If a user follows a URL to a page that is dynamically generated, it may be that the information on that page is state dependent. If the client browser or proxies cache the generated page associated with a given URL, the server has no chance to re-generate the page. To avoid this, HHTP response header fields may be set to indicate that caching should be turned off.
A PreparedStatement is an SQL query written with "?" as placeholders for values to be filled in later. A simple Statement has no such facility. In addition to making the programming more convienient, a PreparedStatement may also be implemetned more efficiently using, for instance, stored procedures on the database server.
GET /doc/intro.html HTTP/1.0\n
\n
The alternative, to define it as <, would not work.
In the ENTITY tag definition, the first round of replacement would take
place, replacing this by the character '<'. The expansion of <
would therefore result in the literal text '<' getting inlined,
and this would start an XML tag.
To solve the problem, < expands to "<" in the XML text.
These literal characters do not force a start tag but are drawn as a < character
when displayed.
<html> <frameset rows="75%,25%"> <frame src="1.html"> <frameset cols="100,*"> <frame src="2.html"> <frame src="3.html"> </frameset> </frameset> </html>
<html> <head> <style type="text/css"><!-- .red { color: red } --></style> </head> <body> <h2 class="red">This heading is red</h2> </body> </html>
grocery.xml: <?xml version="1.0" encoding="iso-8859-1"?> <?xml-stylesheet type="text/xsl" href="grocery.xsl"?> <!DOCTYPE grocery SYSTEM "grocery.dtd"> <grocery> <item> <name>milk</name> <price>$1.12</price> <quantity>8023</quantity> <image>milk.gif</image> </item> <item> <name>beans</name> <price>$0.69</price> <quantity>218</quantity> <image>beans.gif</image> </item> </grocery> grocery.dtd: <!ELEMENT grocery (item+)> <!ELEMENT item (name,price,quantity,image)> <!ELEMENT name (#PCDATA)> <!ELEMENT price (#PCDATA)> <!ELEMENT quantity (#PCDATA)> <!ELEMENT image (#PCDATA)> grocery.xsl <?xml version="1.0" encoding="iso-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="html"/> <xsl:template match="/grocery"> <html> <head> <title>Grocery List</title> </head> <body> <table border="1"> <tr> <th>name</th> <th>price</th> <th>quantity</th> <th>image</th> </tr> <xsl:apply-templates select="item"/> </table> </body> </html> </xsl:template> <xsl:template match="item"> <tr> <td> <xsl:value-of select="name"/> </td> <td> <xsl:value-of select="price"/> </td> <td> <xsl:value-of select="quantity"/> </td> <td> <img> <xsl:attribute name="src"> <xsl:value-of select="image"/> </xsl:attribute> </img> </td> </tr> </xsl:template> </xsl:stylesheet>
JS: <html> <head> <!-- set script type for intrinsic event scripts --> <meta http-equiv="Content-Script-Type" content="text/javascript"> <title>Guessing Game</title> <script type="text/javascript" language="javascript"> function doguess(g) { if( g == 1 ) { alert("correct"); } else { alert("incorrect"); } } </script> </head> <body> <form name="guessform"> <p>Guess a number between 1 and 10: <input name="guessentry" type="text"></input> <input type="button" onclick="doguess(document.guessfor.guessentry.value)"></input> </form> </body> </html> CGI: #!/usr/bin/perl use CGI qw/:standard/; print header, start_html("Guessing Game"), start_form, p, "Guess a number between 1 and 10: ", textfield('guessentry'), submit, end_form; if(param()) { if( param("guessentry") == 1 ) { print hr, p, "correct"; else { print hr, p, "incorrect"; } } print end_html; Servlets: import java.io.*; import javax.servlet.*; import javax.servlet.http.*; class GuessServlet extends HttpServlet { public void doGet(HttpServletRequest req, HttpServletResponse res) { res.setContentType("text/html"); PrintWriter out = res.getWriter(); out.println("<head><title>Guessing Game</title></head>"); out.println("<body>"); out.println("<form method='get' action='GuessServlet'>"); out.println("Guess a number between 1 and 10: "); out.println("<input name='guessentry' type='text'></input>"); out.println("<input type='submit'></input>"); out.println("</form>"); if( req.getParameterNames().hasMoreElements() ) { String guess = req.getParameter("guessentry"); if( guess != null ) { out.println("<hr><p>"); if( guess.trim().equals("1") ) out.println("correct"); else out.println("incorrect"); } } out.println("</body>"); out.println("</html>"); } }