JSP Introduction
What is Java Server Pages?
JSP stands for Java Server Pages, and it is a dynamic web page development technology. It uses JSP tags to insert Java code into HTML pages. Tags usually begin with <% and end with %>.
JSP is a Java servlet, mainly used to implement the user interface part of Java web applications. Web developers write JSP by combining HTML code, XHTML code, XML elements, and embedded JSP actions and commands.
JSP obtains user input data through web forms, accesses databases and other data sources, and then dynamically creates web pages.
JSP tags have various functions, such as accessing databases, recording user selection information, accessing JavaBeans components, and can also pass control information and share information between different web pages.
Why use JSP?
JSP programs have similar functions to CGI programs, but compared with CGI programs, JSP programs have the following advantages:
- Superior performance, because JSP can directly embed elements dynamically in HTML pages without needing to separately reference CGI files.
- The server calls already compiled JSP files, unlike CGI/Perl which must first load the interpreter and target script.
- JSP is based on the Java Servlet API; therefore, JSP has various powerful enterprise-level Java APIs, including JDBC, JNDI, EJB, JAXP, and so on.
- JSP pages can be used together with Servlets that handle business logic. This pattern is supported by the Java servlet template engine.
Finally, JSP is an indispensable part of Java EE, a complete enterprise-level application platform. This means JSP can be used to implement the most complex applications in the simplest way.
Advantages of JSP
The following lists other benefits of using JSP:
- Compared with ASP: JSP has two major advantages. First, the dynamic part is written in Java, not VB or other MS-specific languages, so it is more powerful and easier to use. Second, JSP is easy to port to non-MS platforms.
- Compared with pure Servlets: JSP can easily write or modify HTML pages without having to face a large number of println statements.
- Compared with SSI: SSI cannot use form data or perform database connections.
- Compared with JavaScript: Although JavaScript can dynamically generate HTML on the client side, it is difficult to interact with the server, so it cannot provide complex services such as database access and image processing, etc.
- Compared with static HTML: static HTML does not contain dynamic information.
What's next?
We will guide you step by step to set up the JSP runtime environment, which requires some basic knowledge of Java.
If you have not learned Java yet, you can first learn theJava Tutorial。
Other Extensions