View unanswered posts | View active topics It is currently 2018-12-15 0:31



This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
 往前台传多个值 
Author Message
新手上路

Joined: 2013-04-15 13:03
Posts: 24
Post 往前台传多个值
private SVGContext generateCusAtt(){
SVGContext context =new SVGContext();//定义SVGContext,存放SVG生成过程中的临时数据
context.setSvgHeader(false);//不输出svg格式的头格式串
context.setDefaultFontSize(8);//设置字体大小
//嵌入属性,信息将作为节点的属性嵌入
context.setElementHeadCustomAttributeGenerator(new Generator() {
public Object generate(Object object) {
String name = ((Element)object).getName();
String id = (String) ((Node)object).getClientProperty("id");
if(name != null){
return "name='" + WebUtil.xmlEscape(name)+"'";
}
return null;
}
});

return context;
}

我想在传个id过去,但是

return "name='" + WebUtil.xmlEscape(name)+"'"+" "+"id='"+id+"'";这样以后,我前台的图就不能显示了


2013-04-17 10:48
Profile
TWaver开发组
User avatar

Joined: 2012-07-27 17:20
Posts: 50
Post Re: 往前台传多个值
syd1227 wrote:
private SVGContext generateCusAtt(){
SVGContext context =new SVGContext();//定义SVGContext,存放SVG生成过程中的临时数据
context.setSvgHeader(false);//不输出svg格式的头格式串
context.setDefaultFontSize(8);//设置字体大小
//嵌入属性,信息将作为节点的属性嵌入
context.setElementHeadCustomAttributeGenerator(new Generator() {
public Object generate(Object object) {
String name = ((Element)object).getName();
String id = (String) ((Node)object).getClientProperty("id");
if(name != null){
return "name='" + WebUtil.xmlEscape(name)+"'";
}
return null;
}
});

return context;
}

我想在传个id过去,但是

return "name='" + WebUtil.xmlEscape(name)+"'"+" "+"id='"+id+"'";这样以后,我前台的图就不能显示了


return "name='" + WebUtil.xmlEscape(name)+"'"+" "+"id='"+id+"'";这样以后,我前台的图就不能显示了
这样当然不可以呀,name=XX最终返回的是一个属性组的对象,你那样累加返回的一串就没法解析,不过你可以将id和name打包在一起,然后在前台再解析一下,比如哦name = '"+WebUtil.xmlEscape(name + "&&"+id) +"',然后在前台获取name后,截取“&&”后的字符就是其id。


2013-04-17 11:52
Profile
新手上路

Joined: 2013-04-15 13:03
Posts: 24
Post Re: 往前台传多个值
恩,好的,谢啦,我试试。


2013-04-17 14:05
Profile
Display posts from previous:  Sort by  
This topic is locked, you cannot edit posts or make further replies.   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron