Simple JSP Tutorial: exciting script programming _ MySQL

Source: Internet
Author: User
If you use Javaservlets directly, you will have to process HTTP input and HTML output in the Java class. you need rich Java programming experience to build complex applications. The addition of JSP allows you to distinguish the HTML expression logic from the complicated business logic embedded in servlets. This means that the expression layer code can be written by experienced script writers. if you use Java servlets directly, you will have to process HTTP input and HTML output in the Java class, you need rich Java programming experience to build complex applications. The addition of JSP allows you to distinguish the HTML expression logic from the complicated business logic embedded in servlets. This means that the expression-layer code can be written by experienced script writers, while advanced Java developers can concentrate on solving more complex problems in servlets and beans.

JSP can be used no matter whether you have any Java programming knowledge. JSP contains some server labels so that dynamic data can be displayed without writing a line of Java code. You can directly access the bean to complete the operation, and then use the JSP tag to display the result as dynamic content. You can also use servlets to generate beans, and the operation results of the servlets operation are stored in them. then, you can use JSP labels to display the results without writing Java code on the JSP page.

There are three ways to add Java code to your webpage:

1. using declarations (declaration), you can define global variables or Java methods that can be accessed anywhere on the page. The declaration is included in the tag <% !... %>.


2. using scriptlets (script snippets), you can write any logic required for processing in the page, which is included in the <%... %> tag.

3. Expressions (expression), included in <% =... %>. It provides a simple method to display the results of Java expressions. The appended expression is calculated and displayed on the page, as if you have explicitly written the value of the calculation result in the code.

In your own code, you can use some implicit variables (implicit variables)

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.