If you use relative paths in a JSP, you may have problems.Because of the "relative path" in the Web page, he is looking for resources relative to "URL request Address".What does it mean by this sentence?As an example:If we have a project: MYAPPUnder this project, there is a JSP folderThis folder includes the following:login.jsp//Landing pageREGISTER.JPS//Registration pageWe enter the address in the browser
Order:From implementation to now, it has been mainly in. NET, but occasionally in some other language projects. Recently, a Java Web project needs to be developed two times, has not studied JSP so bought a few books self-study to try. The reference is "lightweight Java EE Enterprise Application Practice (4th Edition)". Development environment:System version: Win7 x64JDK Version: 1.8IDE version: Eclipse Java EE IDE for WEB Developers (version:mars.1 r
Javaweb review article 7 jsp and javaweb Article 7 jsp1: Why does JSP exist?
Jsp full name (java server pages) is called a java server Page in Chinese. In Servlet, we found that Servlet can generate dynamic pages, but we have written a lot of html tags in Servlet, in addition, in Servlet, We have to mix a large number of static display content and dynamic product
JSP basics and jsp Basics
JSP is the abbreviation of Java Server Pages, that is, the Server-side Java page.
There are three methods to annotate JSP:
1. HTML comments,
2. JSP comment,
3. Java Script annotation. Three Java annotations are used in
JSP instruction Description: 1, The JSP instruction is used to tell the JSP engine to interpret the conversion parameters of the jsp, they do not produce output information, only during the translation and compilation of the JSP Function. 2,
instruction .page directive , import is a property of the page directivescriptlet, Inside is pure Java code, need semicolon endexpression , the expression does not end with a semicolon; You must never use a method with a return type of void as an expressionThe JSP is transformed by the Web container and a servlet is generated:The contents of the scriptlet and expressions in the JSP are placed in the servlet
Functions and usage of nine built-in JSP objects, and nine built-in jsp objects
A total of nine such objects are pre-defined in JSP: request, response, session, application, out, pagecontext, config, page, exception1. request object javax. servlet. http. HttpServletRequest
The request object represents the request information of the client and is mainly used to
Jsp: useBean Action usageI. Syntax:Id = "beanInstanceName"Scope = "page | request | session | application"{Class = "package. class" |Type = "package. class" |Class = "package. class" type = "package. class" |BeanName = "{package. class | }{/> |> Other elements}This action enables you to load a JavaBean into a JSP page. This is a very useful capability because it enables you to use reusable JAVA classes with
1. Simple grammarExpression Language (EL) is added to JSP 2.0 specification. The purpose of EL is to produce scriptless JSP pages. The syntax of EL in a JSPs is as follows:${EXPR}Here expr Specifies the expression itself.(1) The two commonly used operators in a JSP El are: "." and "[]".The most common operators in JSP
JspLife cycleThe key to understanding the underlying functionality of the JSP is to understand the life cycle that they follow.The JSP lifecycle is the entire process from creation to destruction, similar to the servlet life cycle, except that the JSP life cycle also includes compiling the JSP file into a servlet.Here
What is a session?
Session represents a client-to-server conversation
The session in the Web refers to the amount of time that a user has spent browsing a website, from entering the site to the browser closing, that is, the time it takes for the user to browse the site.
As you can see from the above definition, the session is actually a specific time concept
The session of different users is stored inside the server
Session Object
The session object is a
First, JSP actionActions are special tokens that enable the implementation of multiple lines of Java code through an action tag. Ability to insert files dynamically, Reuse JavaBean components, guide and have a page, and more.Unlike the action element and the instruction element, the action element is run dynamically at the client request and may be run once per client request, while the instruction element is compiled and run at compile time, and it i
First, JSP actionActions are special tokens that enable the implementation of multiple lines of Java code through an action tag. Ability to insert files dynamically, Reuse JavaBean components, guide and have a page, and more.Unlike the action element and the instruction element, the action element is run dynamically at the client request and may be run once per client request, while the instruction element is compiled and run at compile time, and it i
First, JSP actionActions are special tokens that enable the implementation of multiple lines of Java code through an action tag. Ability to insert files dynamically, Reuse JavaBean components, guide and have a page, and more.Unlike the action element and the instruction element, the action element is run dynamically at the client request and may be run once per client request, while the instruction element is compiled and run at compile time, and it i
JSP actions use you can dynamically insert a file, reuse the JavaBeans component, advance to another page, or generate an HTML for the Java plug-in. The action you can use is:
(1) Jsp:include--Included in a file when the page is requested.
(2) jsp:usebean--Find or instantiate a JavaBean.
(3) jsp:setproperty--sets a JavaBean property.
(4) jsp:getproperty--inserts the JavaBean attribute into the output.
(5) jsp:forward--allows the requester to move for
JSP three major instructions----------------------------------------------A JSP page, you can have a definition of 0~n instructions!1. Page-and most complex: format: * Pageencoding and ContentType:> pageencoding: It specifies the current JSP page encoding, as long as not to lie, there will be no garbled! You need to use pageencoding! when the server wants to comp
JSP compiler directives are information that notifies the JSP engine that it does not generate output directly. There are three common compiler directives:Page directiveThis directive is a descriptive instruction for the entire JSP page. The syntax format is as follows:The% @page[language= "Java"][extends= "Package.class"][import=] Package. Class|package. *},..."
Learning Points of knowledgeJSP, which will eventually become a servletThe JSP eventually becomes a complete servlet that runs in the Web application, except that the Servlet class is written by the container.The Scriptlet in JSPThe so-called Scriptlet is the Java code placed in the
out.println(com.inspur.Counter.getCount());
%>
Directives in the JSPThe difference between JSP
JSP static import and dynamic import, jsp static ImportJSP static import (JSP command mark include)
When a JSP page is requested for the first time, it is translated into a Servlet Java file by the JSP engine and then compiled into a bytecode file for execution.The
JSP custom tag simple getting started tutorial, jsp custom getting started tutorial
The following is the official sun document.
Official Document statement
public interface SimpleTagextends JspTagInterface for defining Simple Tag Handlers.Simple Tag Handlers differ from Classic Tag Handlers in that instead of supporting doStartTag() and doEndTag(), the SimpleTag interface provides a simple doTag() method, w
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.