jsp传统自定义实现年月日输出格式
来源:互联网 发布:linux ruby 安装 编辑:程序博客网 时间:2024/05/20 18:51
1、在web.xml文件里配
<description>there are custom tags of class3g</description> <tlib-version>1.0</tlib-version> <short-name>Date</short-name> <uri>http://www.Date.com</uri> <tag> <description>demo</description> <name>dateTag</name> <tag-class>cn.csdn.web.tag.DateTag</tag-class> <body-content>scriptless</body-content> </tag>
2、在jsp页面里写上
<date:dateTag>2011-10-12</date:dateTag>
3、编写一个实现tag接口的实现类
package cn.csdn.web.tag;import java.io.IOException;import javax.servlet.jsp.JspException;import javax.servlet.jsp.JspWriter;import javax.servlet.jsp.tagext.BodyContent;import javax.servlet.jsp.tagext.BodyTagSupport;public class DateTag extends BodyTagSupport {@Overridepublic int doStartTag() throws JspException {return super.doStartTag();}@Overridepublic int doEndTag() throws JspException {BodyContent bc = this.getBodyContent();String content = bc.getString();String[] str = content.split("-");String date[] = { "年", "月", "日" };JspWriter out = this.pageContext.getOut();for (int i = 0; i < str.length; i++) {try {out.write(date[i] + ":");out.write(str[i]);out.write("<br>");} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}return super.doEndTag();}}
- jsp传统自定义实现年月日输出格式
- jsp传统自定义标签
- 如何实现自定义格式字符串的输出
- 使用IFormattable实现自定义格式字符串输出
- mapreduce实现writable接口自定义输出格式
- jsp自定义标签晋级【实现循环输出】
- ios自定义输出格式
- hadoop自定义输出格式
- 输出年月日
- 输出年月日
- 自定义JSP标签详解------传统标签
- jsp-自定义标签-传统标签开发
- 用jsp 自定义标签实现字符串转换时间格式
- 用jsp 自定义标签实现字符串转换时间格式
- 用CDate类成员函数实现对用户按照年月日格式输入的日期加一天后按照年/月/日格式输出
- JSP自定义标签(二):JSP传统标签
- Rails 日期自定义输出格式
- hadoop自定义文件输出格式
- ubuntu 下怎样查看txt格式文本
- 字典树的简单介绍及其如何求最短前缀
- 服务器配置
- 重定向与编码设置
- JDBC数据库连接规范代码
- jsp传统自定义实现年月日输出格式
- 信息的过滤
- 注册页面实现
- 过滤信息
- 一个留言板
- 一个简单的操作
- servlet图片更新
- 将手机的屏幕改为原来屏幕的一半
- 2011ACM 成都现场 I题