JSP (3)--adding dynamic content by expression

Source: Internet
Author: User
Tags current time expression
js| dynamic in our previous chapters, any HTML file can be transformed into a JSP file by changing its extension to. jsp. Of course, we need to know what makes JSP useful? The answer is the ability to embed Java. Place the following text in a file with a. jsp extension, such as a myjsp.jsp file, and then place the file in your JSP directory and look it up in the browser. The following are the specific code:

<HTML>

<BODY>

Hello! The time was now <%= new Java.util.Date ()%>

</BODY>

</HTML>

Notice here that every time you overload a Web page in a browser, it appears at the current time. The function of the character series <%= and%> is to circle the Java expression, which is computed at run time.

Because of this, it is possible to use JSP to generate Dynamic HTML Web pages in response to the user's actions.

Well, after the end of the tutorial you'd better practice: Write a JSP for the different system properties to output the values returned by System.getproperty, such as Java.version, Java.home, Os.name, User.home and User.dir and so on.


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.