search
HomeJavajavaTutorialwhat language is used in jsp

what language is used in jsp

May 18, 2019 pm 03:23 PM
jsp

A JSP page can be divided into the following parts: static data, such as HTML, css, js, JSP instructions, such as include instructions, JSP script elements and variables, JSP actions, user-defined tags, static data, etc.

what language is used in jspThe content of the static data in the input file is exactly the same as the content output to the HTTP response. At this time, the JSP input file will be an HTML page without embedded JAVA or actions. Moreover, the client will get the same response content every time it requests.
JSP directive
The JSP directive controls how the JSP compiler generates servlets. The following are the available directives: Include directive include – The include directive tells the JSP compiler to completely include another file into the current file. middle. The effect is as if the contents of the included file are pasted directly into the current file. This functionality is very similar to that provided by the C preprocessor. The extension of the included file is generally jspf (JSPFragment, JSP fragment):

Page command page – The page command has the following options:

import causes a JAVA import statement to be inserted into the final page file.

contentType specifies the type of generated content.

Use when generating non-HTML content or when the current character set character set is not the default character set. errorPage When processing HTTP requests, if an exception occurs, the error message page will be displayed.

isErrorPage If set to TRUE, it means that the current file is an error page.

isThreadSafe indicates whether the final generated servlet is thread safe (threadsafe).

Note: Only the import page directive can be used multiple times in the same JSP file. Tag library directive taglib – The tag library directive describes the JSP tag library to be used. This directive needs to specify a prefix (similar to the C namespace) and the description URI of the tag library:

JSP Script
Standard script variables
The following are script variables that are always available:

out – the data used by JSPWriter to write to the response stream

page – servlet itself

pageContext – A PageContext instance contains data associated with the entire page. A given HTML page can be passed between multiple JSPs.

request – HTTP request object

response – HTTP response object

session – an object used to maintain the connection between the client and the server Script element
There are three basic scripts Element, its function is to enable JAVA code to be directly inserted into the servlet. One is to declare the tag and put the definition of a variable in the class body of JAVA SERVLET.

Static data members can also be defined in this way. One is a script tag, which puts the included statement in the _jspService() method of the JAVA SERVLET class.

One is the expression tag, which puts the expression to be assigned in the JAVA SERVLET class. Note that the expression cannot start with End with semicolon.

JSP Action
JSP action is a series of XML tags that can call functions built into the web server. JSP provides the following actions: jsp:include Similar to the sub-process, JAVA SERVLET temporarily takes over the requests and responses to other specified JSP pages. When the JSP page is processed, control is immediately returned to the current JSP page. This way JSP code can be shared among multiple JSP pages without duplication.

jsp:param can be used between jsp:include, jsp:forward or jsp:params blocks. Specifies a parameter that will be added to the current parameter group of the request.

jsp:forward is used to handle requests and responses to another JSP or SERVLET. Control is never returned to the current JSP page.

jsp:plugin Older versions of Netscape Navigator and Internet Explorer use different tags to embed an applet. This action generates the specified browser tag required to embed an APPLET.

jsp:fallback The content that will be displayed if the browser does not support APPLETS. jsp:getProperty Gets a property value from the specified JavaBean. jsp:setProperty sets a property value in the specified JavaBean.

jsp:useBean Create or reuse a JavaBean variable to the JSP page.

JSP technology can be easily integrated into a variety of application architectures to leverage existing tools and techniques, and can be expanded to support enterprise-level distributed applications. As part of the Java technology family and an integral part of Java 2 (Enterprise Edition Architecture), JSP technology can support highly complex Web-based applications. Because the built-in scripting language of JSP pages is based on Java, and all JSP pages are compiled into Java Servlets, JSP pages have all the benefits of Java technology, including robust storage management and security. As part of the Java platform, JSP has the "write once, run anywhere" feature of the Java programming language.

The above is the detailed content of what language is used in jsp. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?How do I use Maven or Gradle for advanced Java project management, build automation, and dependency resolution?Mar 17, 2025 pm 05:46 PM

The article discusses using Maven and Gradle for Java project management, build automation, and dependency resolution, comparing their approaches and optimization strategies.

How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?How do I create and use custom Java libraries (JAR files) with proper versioning and dependency management?Mar 17, 2025 pm 05:45 PM

The article discusses creating and using custom Java libraries (JAR files) with proper versioning and dependency management, using tools like Maven and Gradle.

How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?How do I implement multi-level caching in Java applications using libraries like Caffeine or Guava Cache?Mar 17, 2025 pm 05:44 PM

The article discusses implementing multi-level caching in Java using Caffeine and Guava Cache to enhance application performance. It covers setup, integration, and performance benefits, along with configuration and eviction policy management best pra

How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?How can I use JPA (Java Persistence API) for object-relational mapping with advanced features like caching and lazy loading?Mar 17, 2025 pm 05:43 PM

The article discusses using JPA for object-relational mapping with advanced features like caching and lazy loading. It covers setup, entity mapping, and best practices for optimizing performance while highlighting potential pitfalls.[159 characters]

How does Java's classloading mechanism work, including different classloaders and their delegation models?How does Java's classloading mechanism work, including different classloaders and their delegation models?Mar 17, 2025 pm 05:35 PM

Java's classloading involves loading, linking, and initializing classes using a hierarchical system with Bootstrap, Extension, and Application classloaders. The parent delegation model ensures core classes are loaded first, affecting custom class loa

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft