package tag;

import java.io.IOException;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.SimpleTagSupport;

public class MsgTag extends SimpleTagSupport{
	private String info;
	private int qty;
	public MsgTag(){
		System.out.println("MsgTag's constructor...");
	}
	public void setInfo(String info) {
		System.out.println("setInfo..." + info);
		this.info = info;
	}

	public void setQty(int qty) {
		System.out.println("setQty..." + qty);
		this.qty = qty;
	}

	@Override
	public void doTag() throws JspException, IOException {
		System.out.println("doTag...");
		//通过SimpleTagSupport提供的getJspContext方法
		//获得PageContext。PageContext提供了获得其它
		//几个隐含对象的方法。
		PageContext ctx = (PageContext)getJspContext();
		JspWriter out = ctx.getOut();
		for(int i=0;i < qty;i++){
			out.println(info + "<br/>");
		}
	}
	
}
最近下载更多
wallioms65  LV5 2020年9月8日
Amandd  LV9 2019年10月7日
HareXin  LV13 2019年7月6日
A358641273  LV8 2019年5月6日
shanpengnian  LV13 2019年4月9日
故事_sun  LV26 2018年5月28日
西门无敌  LV10 2018年3月6日
liuzhewnu  LV3 2016年10月30日
maruntao  LV6 2016年4月1日
andinker  LV10 2016年3月22日
最近浏览更多
luandjustin 2023年7月3日
暂无贡献等级
mhywad 2023年6月25日
暂无贡献等级
hanl  LV12 2023年5月23日
微信网友_6411724627349504  LV3 2023年4月3日
a197304a 2023年1月8日
暂无贡献等级
Smile。  LV9 2022年10月27日
329512801  LV28 2022年1月18日
fengbaoxin  LV3 2021年9月16日
xb1406112453  LV5 2021年2月22日
yuanfang123  LV2 2020年12月9日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友