taglib的context标签
来源:互联网 发布:xcode 9 mac os 编辑:程序博客网 时间:2024/05/16 06:30
package edu.inspuruptec.su02.utils;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class TagConfig extends TagSupport{
private String words;
private String fontcolor;
public String getFontcolor() {
return fontcolor;
}
public void setFontcolor(String fontcolor) {
this.fontcolor = fontcolor;
}
public String getWords() {
return words;
}
public void setWords(String words) {
this.words = words;
}
@Override
public int doStartTag() throws JspException {
// TODO Auto-generated method stub
System.out.println("start call TagConfig.....doStartTag()....");
JspWriter out=this.pageContext.getOut();
HttpServletRequest htr=(HttpServletRequest)pageContext.getRequest();
String pass=htr.getContextPath();
Date date=new Date();
SimpleDateFormat sdf=new SimpleDateFormat("yyyy MM dd hh:mm:ss");
String currenttime=sdf.format(date);
try {
out.print("<span><font color='"+this.fontcolor+"'>"+"当前系统时间是"+currenttime+" 当前路径是"+pass+"你输入的问候语是:"+this.words+"</front></span>");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return this.EVAL_BODY_INCLUDE;
//return this.SKIP_BODY;//它很没用。
}
@Override
public int doEndTag() throws JspException {
// TODO Auto-generated method stub
return EVAL_PAGE;
//return SKIP_PAGE;//跟在他后面要倒霉
}
/*public int doStartTag(){
System.out.println("start call TagConfig.....doStartTag()....");
JspWriter out=this.pageContext.getOut();
HttpServletRequest htr=(HttpServletRequest)pageContext.getRequest();
String pass=htr.getContextPath();
try {
out.print("当前路径是"+pass);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return this.EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspException {
// TODO Auto-generated method stub
return EVAL_PAGE;
}*/
}
- taglib的context标签
- 自定义标签 taglib的使用
- JSP标签的pager-taglib分页标签
- Taglib标签
- 比较全面的taglib标签库介绍
- jsp 标签taglib不起作用的问题
- Struts2的Taglib 之 8.2 数据标签
- [j2ee]使用标签时引用的taglib...
- pager-taglib标签的相关属性
- java web taglib自定义标签的练习
- Struts标签库<taglib>的异常
- java web taglib自定义标签的练习
- taglib标签的uri属性 错误
- 引入正确的taglib标签 以及正确使用标签
- tomcat 标签 taglib
- taglib标签库详解
- taglib标签提示错误
- Struts标签taglib指南
- 弹出的纳税基本信息页面
- 将Web应用打包成WAR文件的方法
- Linksys Model BFW11S4配置
- 水晶报表发布后工具栏出错
- CE配置文件特殊符号的含义
- taglib的context标签
- 程序员规划职业道路时需考虑的十个问题
- pagefilter
- web服务器介绍
- Ajax的一些体会
- windows查看端口占用情况方法
- 百钱百鸡问题
- 定义C/C++全局变量/常量几种方法的区别
- Vs2005下重复定义的问题解决 ... already defined in ...