JSP Learning Step 2nd-Tag use

Source: Internet
Author: User

Tag similar to an ASP. NET user control for dynamically displaying HTML

I first set up the tags directory in the project/webcontent/web-inf/to store the tag file

Create a new Message.tag file, as follows:

<%@ Tag Language="Java"pageencoding="UTF-8"%><%@ attribute Name="ID"type="java.lang.String"Required="true"Description="ID"%><%@ attribute Name="msg"type="java.lang.String"Required="true"Description="display text"%><%@ attribute Name="Description"type="java.lang.String"Required="false"Description="Tips" %><DivID= "${id}">message: ${msg}<BR/>Description:<span>${description}</span></Div>

To be used in the JSP interface, first introduce

<% @ taglib Prefix = " Tags " Tagdir = " /web-inf/tags " %>

Use:

<id= "msg"  msg= "RHYTHMK"  description= " My personal blog "></tags:message>

Attention:

The Tag property cannot be capitalized when it is defined, and the following error occurs when the ID is written as above:

JSP Learning Step 2nd-Tag use

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.