互联网开发技术第七讲Web技术.ppt
《互联网开发技术第七讲Web技术.ppt》由会员分享,可在线阅读,更多相关《互联网开发技术第七讲Web技术.ppt(26页珍藏版)》请在三一办公上搜索。
1、互联网开发技术Internet Systems Development Technologies,蔡 剑,Ph.D.Assistant Professor in Management Science and E-BusinessGuanghua School of ManagementPeking University,本讲内容,Web层技术(III)Custom TagsJSP and XMLJSTLAbout The Course Project:Group present there projects in next weekProposals due in next week,Revi
2、ew:Use JavaBeans with JSP,JSP handles the face.JavaBean handles the logic and complexity.,Custom JSP Tag,Simple Custom Tag:Attribute Custom Tag:/Use tld file to config the tag attributes3.Body Custom Tag:,Custom JSP Tag(Cont),4.Custom Tag can be used in Script:,Custom Tag Development,采用特定的API编写实现标签处
3、理的程序位置/WEB-INF/classes or/WEB-INF/lib 建立一个tag library descriptor(TLD)文件用来描述custom tag位置/WEB-INF,Tag Library Descriptor,1.0 1.2 ics IcsampleTag Sample TLD in JWAD Book,Tag Library Descriptor(Cont),wordcount empty inputname true false warnEmpty true true boolean,A Simple Tag,public class TimeTag imple
4、ments Tag public int doStartTag()throws JspException try calendar=Calendar.getInstance();pageContext.getOut().print(DateFormat.getDateInstance().format(calendar.getTime()+DateFormat.getTimeInstance().format(calendar.getTime();catch(IOException tage)throw new JspException(TimeTag Error:+tage.getMessa
5、ge();return SKIP_BODY;public int doEndTag()throws JspException return SKIP_PAGE;,Simple Tag Result,Current Time is:,A Attribute Tag,public class WordCount extends TagSupport public void setInputname(String _inputname)this.inputname=_inputname;public void setWarnEmpty(boolean _warnempty)this.warnEmpt
6、y=_warnempty;public int doEndTag()throws JspException JspWriter out=pageContext.getOut();inputword=pageContext.getRequest().getParameter(inputname);tryif(inputword=null)&(warnEmpty=true),A Attribute Tag,else StringTokenizer st=new StringTokenizer(inputword);int wordnumber=st.countTokens();out.printl
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 互联网 开发 技术 第七 Web
![提示](https://www.31ppt.com/images/bang_tan.gif)
链接地址:https://www.31ppt.com/p-6404968.html