The Hello, World example is extracted from samples of tomcat, the other is not.
Hello, World
(Code can be found in attachment tags0727.zip)
It's stupid and simple. You just need to do:
A bit more complex tag file
(Code can be found in attachment tags0727.zip)
What a dull matter if a tag file contains only plain text! Actually, it can use HMTL element, its own attribute, and so on.
Just define another tag file pinfo.tag in /WEB-INF/tags, and put the following content to it:
<%@ tag language="java" pageEncoding="ISO-8859-1"%>
<%@ attribute name="district" %>
<%@ attribute name="email" %>
<%@ attribute name="phone" %>
<br/>I live in ${district},
<br/>my email is ${email},
<br/>and ${phone} is my cell phone number.
Add the below to the JSP file:
<hw:pinfo district="Shanghai, China" phone="12345678901" email="iridiumcao@gmail.com"/>
All work has been done. The output to user browser is:
I live in Shanghai, China,
my email is iridiumcao@gmail.com,
and 12345678901 is my cell phone number.