📄 mytagparam.java
字号:
package cn.tag;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.TagSupport;
public class MytagParam extends TagSupport{
private static final long serialVersionUID = 1L;
protected String value = null;
protected String type = null; //指定参数为时间还是地点
public void setValue(String value){
this.value = value;
}
public String getValue(){
return value;
}
public void setType(String type){
this.type = type;
}
public String getType(){
return type;
}
//容器遇到开始标签时,调用的方法
public int doEndTag() throws JspException{
MytagInfo mi = (MytagInfo)this.getParent(); //获得父标签
if(type.equals("date")) //判断是否为时间
mi.setDate(value);
else if(type.equals("address")) //判断是否为地点
mi.setAddress(value);
else //当时间和地点都不是时
{
mi.setAddress("Error");
mi.setDate("Error");
}
return EVAL_PAGE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -