标题:自定义标签库的问题
只看楼主
roy_guo
Rank: 1
等 级:新手上路
帖 子:107
专家分:0
注 册:2006-4-27
 问题点数:0 回复次数:3 
自定义标签库的问题
初次接触,请问自定义标签可以输出可以被执行的JS脚本么?
public int doStartTag() throws JspException
{
try
{
context.getOut().print("d = new dTree('d');");
context.getOut().print("d.add(0,-1,'My example tree');");
context.getOut().print("d.add(1,0,'Node 1','example01.html');");
context.getOut().print("d.add(2,0,'Node 2','example01.html');");
context.getOut().print("d.add(3,1,'Node 1.1','example01.html');");
context.getOut().print("d.add(4,0,'Node 3','example01.html');");
context.getOut().print("d.add(5,3,'Node 1.1.1','example01.html');");
context.getOut().print("d.add(6,5,'Node 1.1.1.1','example01.html');");
context.getOut().print("d.add(7,0,'Node 4','example01.html');");
context.getOut().print("d.add(8,1,'Node 1.2','example01.html');");
context.getOut().print("d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');");
context.getOut().print("d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');");
context.getOut().print("d.add(11,9,'Mom\'s birthday','example01.html');");
context.getOut().print("d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');");
context.getOut().print("document.write(d);");
}
catch(IOException ex)
{
throw new JspException(ex.getMessage());
}
return SKIP_BODY;
}
这里需要做什么修改么?
搜索更多相关主题的帖子: 定义 
2006-11-19 13:03
神vLinux飘飘
Rank: 13Rank: 13Rank: 13Rank: 13
来 自:浙江杭州
等 级:贵宾
威 望:91
帖 子:6140
专家分:217
注 册:2004-7-17
得分:0 
自定义标签是可以输出被执行的JS脚本的,这点只要了解JAVA的WEB程序的运行周期就明白了

至于你的程序是否需要修改....我怎么知道你要什么样的效果啊...

淘宝杜琨
2006-11-19 13:05
roy_guo
Rank: 1
等 级:新手上路
帖 子:107
专家分:0
注 册:2006-4-27
得分:0 
context.getOut().print("。。。
里面的东西是要输出的JS原网页里的脚本,我只是想在class文件中动态的生成

彪悍的人生不需要解释~~~
2006-11-19 13:22
roy_guo
Rank: 1
等 级:新手上路
帖 子:107
专家分:0
注 册:2006-4-27
得分:0 

问题解决,是自己的疏忽~~~
谢谢了


彪悍的人生不需要解释~~~
2006-11-19 16:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-103978-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 1.588373 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved