1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
| package myTags;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import java.text.*;
import java.util.*;
public DateTag extends TagSupport {
public int doStartTag() throws javax.servlet.jsp.JspException {
HttpServletRequest req;
Locale locale;
HttpJspPage g;
DateFormat df;
String date;
JSPWriter out;
req = ( HttpServletRequest )pageContext.getRequest();
locale = req.getLocale();
df = SimpleDateFormat.getDateInstance(
SimpleDateFormat.FULL,locale );
date = df.format( new java.util.Date() );
try {
out = pageContext.getOut();
out.print( date );
} catch( IOException ioe ) {
throw new JspException( "I/O Error : " + ioe.getMessage() );
}//end try/catch
return Tag.SKIP_BODY;
}//end doStartTag()
}//end DateTag
|