当前位置: 首页 > news >正文

网站赏析案例牡丹江林口县建设局网站

网站赏析案例,牡丹江林口县建设局网站,淮安市做网站,暴雪中国官网SiteMesh参考 作者#xff1a;kongxx (kongxxgmail.com)安装 首先从sitemesh下载安装包#xff0c;这里使用的是2.2.1版本。 创建一个Web应用程序#xff0c;这里我创建一个名为myapp的Web应用程序#xff1b; 复制sitemesh-2.2.1.jar文件到{myapp}/WEB-INF/lib目录下kongxx (kongxxgmail.com) 安装 首先从sitemesh下载安装包这里使用的是2.2.1版本。 创建一个Web应用程序这里我创建一个名为myapp的Web应用程序 复制sitemesh-2.2.1.jar文件到{myapp}/WEB-INF/lib目录下 编辑{myapp}/WEB-INF/web.xml文件 ?xml version1.0 encodingUTF-8? web-app xmlnshttp://java.sun.com/xml/ns/j2ee      xmlns:xsihttp://www.w3.org/2001/XMLSchema-instance      xsi:schemaLocationhttp://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd      version2.4     filter    filter-namesitemesh/filter-name    filter-classcom.opensymphony.module.sitemesh.filter.PageFilter/filter-class    /filter        filter-mapping    filter-namesitemesh/filter-name    url-pattern/*/url-pattern    /filter-mapping         session-config     session-timeout         30     /session-timeout     /session-config     welcome-file-list     welcome-file         index.jsp     /welcome-file     /welcome-file-list /web-app 添加蓝色高亮部分。 在{myapp}/WEB-INF/目录下创建decorators.xml文件并且输入一下内容 ?xml version1.0 encodingISO-8859-1? decorators defaultdir/decorators     decorator namemain pagemain.jsp         pattern/*/pattern     /decorator     decorator namepanel pagepanel.jsp/     decorator nameprintable pageprintable.jsp/ /decorators 安装完毕。 例子1 在{myapp}/WEB-INF/decorators.xml文件中添加以下decorator decorator namemydecorator1 pagemydecorator1.jsp         pattern/test1.jsp/pattern     /decorator 在{myapp}/decorators目录下添加mydecorator1.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % html     head         titleMy Site - decorator:title defaultWelcome! //title         decorator:head /     /head     body         decorator:body /         pThis message is in /decorators/mydecorator1.jsp/p            /body /html 在{myapp}目录下添加test1.jsp文件内容如下 %page contentTypetext/html% %page pageEncodingUTF-8% html     head         meta http-equivContent-Type contenttext/html; charsetUTF-8         titleThis is test1/title     /head     body     bThis is test1/b     /body /html 打开浏览器访问http://localhost:8080/myapp/test1.jsp将会出现一下内容 This is test1 This message is in /decorators/mydecorator1.jsp 例子2 (decorator:getProperty tag) 有时候我们期望修改页面中某个有固定标记的片段例如我们的jsp中有一个标记mytag.../mytag此时可以用如下方法实现 在{myapp}/WEB-INF/decorators.xml文件中添加以下decorator decorator namemydecorator2 pagemydecorator2.jsp         pattern/test2.jsp/pattern     /decorator 在{myapp}/decorators目录下添加mydecorator2.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % html     head         titleMy Site - decorator:title defaultWelcome! //title         decorator:head /     /head     body         decorator:body /         decorator:getProperty propertypage.content1/        decorator:getProperty propertypage.content2/                !-- do nothing --        decorator:getProperty propertypage.content3/                 pThis message is in /decorators/mydecorator2.jsp/p     /body /html 在{myapp}目录下添加test2.jsp文件内容如下 %page contentTypetext/html% %page pageEncodingUTF-8% html     head         meta http-equivContent-Type contenttext/html; charsetUTF-8         titleThis is test2/title     /head         body     bThis is test2/b     bUse lt;decorator:getPropertygt; tag/b         content tagcontent1pThis is content1/p/content    content tagcontent2pThis is content2/p/content    content tagcontent4pThis is content4, it shouldnt be display/p/content     /body /html 打开浏览器访问http://localhost:8080/myapp/test2.jsp将会出现一下内容 This is test2 Use decorator:getProperty tag This is content1 This is content2 This message is in /decorators/mydecorator2.jsp 例子3 (page:applyDecorator tag) 在{myapp}/WEB-INF/decorators.xml文件中添加以下decorator     decorator namemydecorator3 pagemydecorator3.jsp         pattern/test3.jsp/pattern     /decorator          decorator namemydecorator31 pagemydecorator31.jsp     /decorator 在{myapp}/decorators目录下添加mydecorator3.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % % taglib urihttp://www.opensymphony.com/sitemesh/page prefixpage % html     head         titleMy Site - decorator:title defaultWelcome! //title         decorator:head /     /head     body         decorator:body /        page:applyDecorator namemydecorator31            content tagcontent1pThis is content1/p/content            content tagcontent2pThis is content2/p/content        /page:applyDecorator     /body /html 在{myapp}/decorators目录下添加mydecorator31.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % % taglib urihttp://www.opensymphony.com/sitemesh/page prefixpage %pibegin/i/decorator:getProperty propertypage.content1/decorator:getProperty propertypage.content2/piend/i/ 在{myapp}目录下添加test3.jsp文件内容如下 %page contentTypetext/html% %page pageEncodingUTF-8% html     head         meta http-equivContent-Type contenttext/html; charsetUTF-8         titleThis is test3/title     /head         body     bThis is test3/b     bUse lt;page:applyDecoratorgt; tag/b     /body /html 注意相对于例子2这里已经没有了content tagXXX/标签。 打开浏览器访问http://localhost:8080/myapp/test3.jsp将会出现一下内容 This is test3 Use page:applyDecorator tag begin This is content1 This is content2 end 这里我在mydecorator3.jsp中应用了mydecorator31.jsp的的decorator并且将原来在test2.jsp中的 content /标签复制到mydecorator3.jsp中此时对于content tagxxx/的标签将会由mydecorator31.jsp了装饰。 例子4 (page:param tag) 在{myapp}/WEB-INF/decorators.xml文件中添加以下decorator     decorator namemydecorator4 pagemydecorator4.jsp         pattern/test4.jsp/pattern     /decorator          decorator namemydecorator41 pagemydecorator41.jsp     /decorator 在{myapp}/decorators目录下添加mydecorator4.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % % taglib urihttp://www.opensymphony.com/sitemesh/page prefixpage % html     head         titleMy Site - decorator:title defaultWelcome! //title         decorator:head /     /head     body         decorator:body /        page:applyDecorator namemydecorator41             content tagcontent1pThis is content1/p/content            content tagcontent2pThis is content2/p/content            page:param namepage.content1pThis content1 has been replaced/p/page:param        /page:applyDecorator     /body /html 在{myapp}/decorators目录下添加mydecorator41.jsp文件内容如下: % taglib urihttp://www.opensymphony.com/sitemesh/decorator prefixdecorator % % taglib urihttp://www.opensymphony.com/sitemesh/page prefixpage %pibegin/i/decorator:getProperty propertypage.content1/decorator:getProperty propertypage.content2/piend/i/ 在{myapp}目录下添加test4.jsp文件内容如下 %page contentTypetext/html% %page pageEncodingUTF-8% html     head         meta http-equivContent-Type contenttext/html; charsetUTF-8         titleThis is test4/title     /head         body     bThis is test4/b     bUse lt;page:paramgt; tag/b     /body /html  打开浏览器访问http://localhost:8080/myapp/test4.jsp将会出现一下内容 This is test4 Use page:param tag begin This content1 has been replaced This is content2 end 这里我在mydecorator4.jsp中应用了mydecorator41.jsp的的decorator并且添加了page:param namepage.content1标签那么此时页面上将会用page:param标签中的内容替换原来在decorator:getProperty propertypage.content1/中的内容因此页面将不在“This is content1”而显示“This content1 has been replaced”。  转载于:https://www.cnblogs.com/wdpp/archive/2007/05/13/2386403.html
http://www.zqtcl.cn/news/866363/

相关文章:

  • 网站网页建设实训心得体会二类电商平台都有哪些
  • 兰州免费网站建设上海城隍庙要门票吗
  • 如何做外贸soho做网站中型网站建设
  • 冠县品牌网站建设推广外贸企业网站管理系统
  • 信息管理的基本原理分析网站建设南阳网站建设制作
  • 网站一直百度上搜不到是怎么回事啊网站建设首保服务
  • 解决网站兼容性问题福州房产网站建设
  • 怀化百度整站优化服务wap网站前景
  • 临沂制作网站企业施工企业汛期工作实施方案
  • 82家合法现货交易所名单永康关键词优化
  • 郑州市建设工程造价信息网站浙江省建设工程质量管理协会网站
  • 乌兰浩特市建设局网站永州微网站建设
  • 做网站的用什么电脑好wordpress首页调用指定分类
  • 网站域名申请好了怎么建设网站室内设计培训班哪个学校好
  • 东莞厚街网站建设网页设计代码字号px
  • 网站建站免费淘宝优惠券网站建设总代
  • 茶叶网站设计建设工程监理招标网站
  • 网站建设发展历程做网站要多少钱 知乎
  • 丽江建设信息网站江门网站制作方案
  • 网站名注册移动端应用开发
  • 本地网站搭建流程短链接生成器app
  • 建网站需要哪些技术代做ppt网站
  • 在上海哪个网站比较好网站建设服务方案ppt模板
  • 天津网站优化流程uniapp微信小程序模板
  • 网站 搜索引擎 提交企业网站必须备案
  • 公司网站主页设计深圳搜索引擎
  • 织梦学校网站中国建设银行官方网站诚聘英才频道
  • 织梦网站去除技术支持网站建设热门吗
  • 手机自助网站建设电商首页设计
  • 个人做电影网站违法吗招标网站哪个好