JAVA EE Learning Note [V1 JSP programming]

Source: Internet
Author: User
Tags java se

At the beginning of March, the school opened a Java EE course, and this began the study of Java EE Foundation. Then the teacher also has certain requirements for this course. The foundation of the front is ready for the final job.

We learned about Java in the last semester, and we have some knowledge about the installation of Java SE, while Java EE is a set of multi-layered and extensible network applications built on the Java SE platform.

To learn Java EE we first build the environment. It's all about using Tomcat for server Building and JDK environment variable configuration. And IDE This aspect we choose MyEclipse CI (this compiler comes with tomcat7.0)

After doing these preparations, we can start our Java EE learning path.

And the beginning of getting started, starting with JSP programming

JSP is the abbreviation for Java Sever pages. is a dynamic Java-language-based web technology pioneered by sun and built with many other companies. It is implemented by inserting Java program segments and JSP tags (<%%>) into a traditional web file to form a JSP file (*.jsp)

After having HTML and Java Foundation, it is not difficult to understand that JSP is the Java language embedded in the text markup language. Grammar rules are bound to conform to the rules of Java syntax.

By convention:

<%@ Page Language="Java"Import="java.util.*"pageencoding="iso-8859-1"%><HTML>  <Body>    <%Out.println ("Hello world!"); %>  </Body></HTML>

Turn on the tomcat server and save the above file as index.jsp in LocalHost's package directory

Visit http://localhost:8080/test/index.jsp

JSP it provides static data only to the user compared to HTML, and JSP technology allows you to nest Java code in the page to provide dynamic data to the user. Rather than Servlets, JSP is nested directly in HTML, making it easier to compose data.

However, the system learning of JSP has the following contents:

JSP syntax: JSP template element JSP expression JSP script fragment JSP static Declaration JSP comment JSP directive JSP tag JSP built-in object

1.JSP template Elements

The HTML content in a JSP page is called a JSP template element. That is, HTML provides a visual interface, and this interface can be called a template element

2.JSP-expression

<% out.println ("Hello world! "  %>

In this format, you can become a JSP expression.

3.JSP Script Fragment

Can be called multi-line Java code in a fragment (within a <% ...%>)

4.JSP Static Declaration

Same as the declaration of static variables in Java:

<% static {     System.out.println ("loading servlet! " ); }%>

5.JSP comments

As part of maintaining and explaining the notes, the notes are important. Write beautiful code This is not rare AH:

Format of JSP annotations:

Single-line comments provided by Java

/* Multi-line comments provided by Java */

<%--JSP Comment--%>

6.JSP instruction

Page directive

Include directives

TAGLIB directive

7.JSP Label

This thing is very useful, to a certain extent can do a lot of things, such as JSP include tag:<jsp:include> tag is dynamic introduction, <jsp:include> tags involved in the 2 JSP pages will be translated into 2 servlet , the contents of these 2 servlets are merged at execution time. (You can do a wave of combination PS: For example, the head and bottom of the blog will not change, this time to write two pieces of two JSP, code optimization-=-)

8.JSP Built-in objects

In order to simplify the development of Web pages, JSP provides some objects implemented and managed by the container, which can be used directly in JSP, without the need of JSP page writing for instantiation, can be used directly, this kind of object is called JSP's built-in object.

The above is some of the basic JSP content, very rough, detailed self-information.

The basic content of JSP understanding is Jiangzi. I slowly down more, the basic content is a bit more, digestion takes time--step a

JAVA EE Learning Note [V1 JSP programming]

Related Article

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.