In the previous tutorial, we used Java. util. Date. Someone may ask: why not only use import java. util? In fact, the import statement can also be used in JSPs, but its syntax is somewhat different from that of common Java. The following is an
In the above tutorial, we have learned how to embed a Java expression between the character series in a JSP webpage. However, it is very difficult to do a lot of programming by placing Java expressions in HTML.
JSP also allows you to write
Now, the JSP file you wrote will be changed to a class definition. All scriptlets you have written should be placed in a method of this class. Similarly, you can add variables and method declarations to this class. Of course, you can also use these
Another important Syntax of JSP is tags (TAG ). JSP tags does not use characters. The ending sign is followed by a backslash (/) character. The flag name contains an embedded colon (:) character, in which the part before the colon describes the
JSP 1.1 proposes an extended JSP flag method named "flag library ". These libraries allow other logos similar to JSP: Include or JSP: forward, but they are not prefixed with JSP: and some features are also attached.
To introduce the flag library,
JSP, ssjs, and NAS
JSP does not replace or threaten ssjs as a web development platform, and they own their own markets. Although JSP is more powerful and flexible than ssjs, you need to write scripts.
Code You must learn Java-at least before a
I saw a lot of questions on the Internet about how to learn JSP. I just saw an article on the Internet about how to learn JSP.
Article I just picked a part of the translation, hoping to help you learn about JSP.
A common error is to treat JSP
The last component related to JSP syntax is called an internal object. In a small JSP instruction file, you can access these internal objects to interact with the servlet environment that executes JSP pages. Access to many internal objects should be
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
The last element related to JSP syntax is an internal object. In a small JSP instruction file, you can access these internal objects to interact with the servlet environment that executes JSP pages. Access to many internal objects should be
Chinese garbled characters in JSP are often messy.
The following two common countermeasures are often visible on the Internet:
Contenttype = "text/html; charset = gb2312" %>
Or:
String HI = "hello ";Byte []Tmpbyte = Hi. getbytes ("iso8859_1 "
XML (Extensible Markup Language) may look like a W3C standard-there is no real impact now, even if it can be used in the future, it will be a long time later. But in fact, it is now applied. Therefore, do not use XML until it has been added to your
Forms are a common way to interact with websites. JSP makes form processing easier. The standard way to process forms in JSP is to define a "bean ". This "bean" is not a full Java bean. You only need to define a class so that it has a region, which
For example, the flag library from the Blazix server cannot be used in your system environment, so do not use the flag library to implement similar functions? This tutorial is for this question. This problem can be solved, but the code is longer.
Familiar with JSP servers
This "JSP from simple to deep" series of tutorials is intended for intermediate and advanced users and requires the basics of HTML and Java. You should connect HTML webpages together and use Java for programming. If you do
Author: Xu Chunjin
Below are some of my experiences in learning JSP:
I. Working Principles of JSP
When a JSP file is requested for the first time, the JSP Engine converts the JSP file into a servlet. The engine itself is also a servlet. In JSWDK
1. You can use:
Response. sendRedirect ("http://www.foo.com/path/error.html ");
2. You can manually modify the Location attribute of the HTTP header as follows:
Response. setStatus (HttpServletResponse. SC _MOVED_PERMANENTLY
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.