An Introduction to Creating Java Cusom Tags for JSPs: IRAD

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
16,830
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Aug 4, 2008

You can watch the high resolution, full screen videos here:

http://www.thebookonhibernate.com/j2ee/index.jsp?link=07customtags

Creating Your Own Custom JSP Tags

This free, multimedia tutorial shows you how to use IBM's Rational Application Developer (IRAD) 6.0 to create a custom tag library (well, one custom tag, so it is a pretty impoverished library), and the corresponding Java code and tld file to make a custom tag work on a JSP page.

If you found something helpful here, please do your part and help support the site. Link to us, buy some books, support our sponsors, tell your developer friends about us, and remember: Happy Java!

package com.examscam.servlet.tags;

import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

import com.examscam.common.Timer;


public class TimerTag extends TagSupport {


public int doStartTag() throws JspException {
JspWriter out = pageContext.getOut();
ServletRequest request = pageContext.getRequest();
ServletResponse response = pageContext.getResponse();
ServletContext application = pageContext.getServletContext();
HttpSession session = pageContext.getSession();

Timer t = (Timer)session.getAttribute("timer");
if (t==null){
t = new Timer();
session.setAttribute("timer", t);
}
try {
out.print("Elapsed Time: " + t.getElapsedTime());
out.print("Start Time: " + t.getStartTime());
} catch (IOException e) { e.printStackTrace();
} return SKIP_BODY;
}
}

Please check out my SCJA Java Certification Mock Exam website:

http://www.scja.com/associate/

And for Hibernate and JPA tutorials, check out:

http://www.thebookonhibernate.com

http://www.scja.com/j2ee/index.jsp?link=03httpsessionswf

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 2 dislikes

Link to this comment:

Share to:
see all

All Comments (4)

Sign In or Sign Up now to post a comment!
  • Its tag library descriptor not tag library defination.

  • great video very helpful...you sound like stewie at 7:36 was that intentional :)

  • if somebudy can help me...i want to make one jsp page with html table populated from database , and i want in every row of table two buttons: delete and edit, and on click i want some action in that row i am new in jsp/java pls help me if you have some examples =]

  • awesome! no annoying typing sound effect!!

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more