当前位置: 首页 > 图文教程 > 网络编程 > JSP > java tapestry5 布局 参数的处理

JSP
我认为JSP有问题(上)
我认为JSP有问题(下)
jsp“抓”网页代码的程序
关于在bean里面打印html的利弊看法
bean里面如何打印到html页面
jdbc3中的RowSet 接口规范
Apusic Application Server1.0中jsp源代码泄漏漏洞
Unify的eWave ServletExec拒绝服务漏洞
通过提交超长的GET请求导致IBM HTTP Server远程溢出
在HTTP请求中添加特殊字符导致暴露JSP源代码文件
Resin 1.2 重要源代码暴露漏洞
多中WEB服务器的通用JSp源代码暴露漏洞
Tomcat 暴露JSP文件内容
IBM WebSphere Application Server 暴露JSP文件内容
JRun 2.3.x 范例文件暴露站点安全信息
BEA WebLogic 暴露源代码漏洞
IBM WebSphere Application Server 3.0.2 存在暴露源代码漏洞
Tomcat 3.1 存在暴露网站路径问题
Sun Java Web Server 能让攻击者远程执行任意命令
Netscape 修复 JAVA 安全漏洞

JSP 中的 java tapestry5 布局 参数的处理


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-13   浏览: 198 ::
收藏到网摘: n/a

在使用时,希望把里边的title,keywords,description动态地更换。
复制代码 代码如下:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd">
<head>
<meta name="keywords" content="${ks}">
<meta name="description" content="${desc}">
<title>${title}</title>
</head>
<body >
<t:body/>
</body>

例如如上一个模版页面,在使用时,希望把里边的title,keywords,description动态地更换。
在模版页面的java类里边添加类似如下代码:
复制代码 代码如下:

@Parameter(defaultPrefix = BindingConstans.LITERAL,name = "title",requred=true)//这里我设为参数必须\
@Property(write=false)//标注不可写的属性
private String title;

最后在使用时:
复制代码 代码如下:

<div t:type="模版" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd" title="这里写你的参数">
XXX
</div>

再重新布置服务器后,已经发现可以显示出正常的标题属性了。。。。