From the course: Java EE: Servlets and JavaServer Pages (JSP)
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Custom tag: Define tag handler and TLD
From the course: Java EE: Servlets and JavaServer Pages (JSP)
Custom tag: Define tag handler and TLD
- [Instructor] Okay now, lets do a very quick Tag Handler Development in our project. So what we're going to do is we are going to develop a custom tag which will format a date, according to a particular format. Of course, now you have this tag in JSTL already, we don't need that but this is just for a demo purpose that we're going to develop this small tag of our own. Okay? So the first thing that we have to do is we've to define the .tld file which is of course a tag library descriptor, it's an XML file. So lets write that out first. Lets go to a project. And we need to create that file under WEB-INF so I'm going to right click here, and call it as an XML file, and give it a name, so appTags.tld There you go. Now, this is of course an XML file and the tags that you're going to write in this XML file are going to come from a namespace. So that namespace has been provided on the slide. I'm just going to copy that and paste it here and then of course, end that taglib. Lets do more…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.