Use of JSP Actions

Source: Internet
Author: User

Jsp (preferred for SUN Enterprise Applications) actions allows you to dynamically insert a file, reuse the JavaBeans component, move forward to another page, or generate an HTML for the Java Plug-in. The following actions can be used:

(1) jsp (preferred for SUN Enterprise Applications): include -- include a file when the page is requested.

(2) jsp (preferred for SUN Enterprise Applications): useBean -- locate or instantiate a JavaBean.

(3) jsp (preferred for SUN Enterprise Applications): setProperty -- set a JavaBean attribute.

(4) jsp (preferred for SUN enterprise-level applications): getProperty -- inserts the JavaBean attribute into the output.

(5) jsp (preferred for SUN Enterprise Applications): forward -- allows the requester to move forward to a new page.

(6) jsp (preferred for SUN enterprise-level applications): plugin -- use the OBJECT or EMBED label to generate specific browser code for Java plugins.

1. jsp (preferred for SUN Enterprise Applications): include Action

This action allows you to include some files on the page to be generated:

<Jsp (preferred for SUN Enterprise Applications): include page = "relative URL" flush = "true"/>
  
Unlike include directive, this action contains files only when the page is requested, while include directive is the preferred choice for SUN Enterprise Applications in jsp) when the page is converted to a servlet, it contains files. To improve efficiency, include action makes a small sacrifice, that is, it does not allow the contained page to contain general jsp (preferred for SUN Enterprise Applications) Code (for example, HTTP header cannot be set), but it has significant flexibility. The following jsp (preferred for SUN Enterprise Applications) code inserts four different fragments into the following page. Each time the title changes, you only need to modify the four files without changing the main jsp (preferred for SUN Enterprise Applications) page.

WhatsNew. jsp (preferred for SUN Enterprise applications)

<HTML>
<HEAD>
<TITLE> jsp (preferred for SUN Enterprise Applications) Tutorial </TITLE>
<BODY>
<CENTER>
<Table border = 5 BGCOLOR = "# EF8429">
<TR> <th class = "TITLE"> What "s New at Chinese comic sites </TABLE>
</CENTER>
<P>
Here is a summary of our four most recent news stories:
<OL>
<LI> <jsp (preferred for SUN Enterprise Applications): include page = "news/Item1.html" flush = "true"/>
<LI> <jsp (preferred for SUN Enterprise Applications): include page = "news/Item2.html" flush = "true"/>
<LI> <jsp (preferred for SUN Enterprise Applications): include page = "news/Item3.html" flush = "true"/>
<LI> <jsp (preferred for SUN Enterprise Applications): include page = "news/Item4.html" flush = "true"/>
</OL>
</BODY>
</HTML>

Of course, you can define yourself? ML files, but note the following:

You should put the file in the news directory under your jsp (preferred for SUN Enterprise Applications) directory.

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.