1.1 Java Servlet and Its FeaturesServlet is the answer of Java technology to CGI programming. Servlet programs run on the server to dynamically generate Web pages. Compared with traditional CGI and many other CGI-like technologies, Java Servlet is
11.1 OverviewAssumerver Pages (JSP) enables us to separate static HTML and dynamic parts of the page. HTML can be written using any commonly used Web production tool in the same way as the original one. Dynamic code is placed in special marks, most
SimpleSendMessage. javaImport java. util .*;Import javax. mail .*;Import javax. mail. internet .*;Import javax. activation .*;Public class SimpleSendMessage {Public static void main (String [] args ){// Collect the necessary information to send a
JSP-Hitcounter counts sessions.Copyright (C) 2000 Jesper Schmitz Mouridsen.Visit www. webappcabaret/jsm2/webapps. jsp? Find = jsphcs for more info.This program is free software; you can redistribute it and/or modify it under the terms of the GNU
Package coreservlets;Import java. io .*;Import javax. servlet .*;Import javax. servlet. http .*;Import java. util .*;/** Creates a table showing the current value of each* Of the standard CGI variables.* * Taken from Core Servlets and assumerver
JSP Bean Example // Write the current value of the property countOut. println ("Count from scriptlet code :"+ Counter. getCount () + " ");%>Count from jsp: getProperty:
I. PrefaceTomcat is a good choice for beginners to execute JSP and Servlet ,. Tomcat is a product of the Apache organization, and sun's support for it is also quite good.Ii. Download and installJAVA official site: jakarta.apache.org, which is also
I. PrefaceTomcat is a good choice for beginners to execute JSP and Servlet. You can also use Resin. Both products do not cost a penny. Resin supports Xml well.Ii. Download and installFor the Resin official site: http://www.caucho.com /.Download from
I. Preparations before runningDownload the mysql jdbc Driver (a jar file) and load it in CLASSPATH (for the method, see one of the JAVA/JSP Learning Series (JDK installation).(If not found, download from this site)Create a MySQL database testThe
6.1 CGI variable OverviewIf you are switching from traditional CGI programming to learning Java Servlet, you may have become accustomed to the concept of "CGI variable. CGI variables collect various request information:Some are from HTTP request
Define entities in jspBeanClu"Class =" cn. domain. CacluBean "> Clu"> Get the bean property value and output the value to the page;
EL expression:$ {Object name}When an el expression is used to retrieve data, it usually uses a. sign or a. Sign.
Nine implicit JSP objects:
Object Name
Description
Scope
Data Type
Request
This object encapsulates the HTTPRequest details (parameters, attributes, headers, and data );
Request (user request period)
Subtype of
Package coreservlets;Import java. io .*;Import javax. servlet .*;Import javax. servlet. http .*;/** Sets six cookies: three that apply only to the current* Session (regardless of how long that session lasts)* And three that persist for an hour
10.1 session status overviewThe Stateless feature of HTTP brings about a series of problems. Especially when shopping through online stores, the server cannot remember the previous transactions smoothly, which becomes a serious problem. It makes it
Paste the Code directly:First, the code of the index_test.jsp page is as follows:Copy codeThe Code is as follows:Request. setCharacterEncoding ("UTF-8 ");Response. setCharacterEncoding ("UTF-8 ");Response. setContentType ("text/html; charset = UTF-8
Cookies are some data that the server stores on the client, such as passwords and some data you have accessed.Set Cookie Copy codeThe Code is as follows:// Set cookieCookie cookie = new Cookie ("TOM", "111 ");// Set the validity period. The default
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service