?? 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 + -