?? mytag.java
字號:
package jsptag;import javax.servlet.jsp.JspException;import javax.servlet.jsp.tagext.TagSupport;public class MyTag extends TagSupport {private String type = "text";//text: \u6587\u672C select\uFF1A\u9009\u62E9public int doStartTag() throws JspException {StringBuffer html = new StringBuffer();if(type.equals("text")){html.append("Hello World");}else if(type.equals("select")){html.append("<select>\n");html.append("<option value=\"1\">hello 1</option>\n");html.append("<option value=\"2\">hello 2</option>\n");html.append("</select>\n");}else{throw new JspException("style define wrong!");}try {pageContext.getOut().write(html.toString());} catch (Exception e) {e.printStackTrace();throw new JspException("write error!");}return SKIP_BODY;}public void setType(String string) {type = string;}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -