用过prefuse的请进!

alen1985 2009-07-01 06:06:24
现在我用的主要是它的GraphView图,通过点击它上面的结点,现在能获取到结点的值,但是我想把这个值传递到jsp中,该如何实现?另外:我把获取的值显示在图上的时候,中文显示的是方框乱码,该如何解决!
...全文
398 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
alen1985 2012-05-02
  • 打赏
  • 举报
回复
[Quote=引用 11 楼 的回复:]

用这个工具怎么画带箭头的有向图啊
[/Quote]

可以用touchgraph
Liverpool_CSDN1 2012-04-24
  • 打赏
  • 举报
回复
用这个工具怎么画带箭头的有向图啊
alen1985 2009-07-02
  • 打赏
  • 举报
回复
现在要用的主要是用js与applet通信来解决了。
alen1985 2009-07-01
  • 打赏
  • 举报
回复
new wordbean(item.getString(label));
public class wordbean extends HttpServlet {

String title;
HttpServletRequest req;
HttpServletResponse res;

public wordbean(String title) throws Exception {
super();
this.title = title;
search(req,res);
}

public void search(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
//response.sendRedirect("http://www.baidu.com");

System.out.println(title);

}
}


现在主要问题是response是空的,response.sendRedirect("http://www.baidu.com");会出错!
alen1985 2009-07-01
  • 打赏
  • 举报
回复
public void search(HttpServletRequest request,HttpServletResponse response){
response.sendRedirect("你的action?value="+temp);
}

这个方法在哪里调用,现在HttpServletRequest request,HttpServletResponse response这个报错,这是一个普通的class
qiheia 2009-07-01
  • 打赏
  • 举报
回复
String temp="";
public void itemClicked(VisualItem item, MouseEvent e) {
// TODO Auto-generated method stub
if (item.canGetString(label))

System.out.println(item.getString(label));
try {
temp=item.getString(label);
System.out.println(new Fre_pos().FindNumP(item.getString(label)));
title.setText(new Fre_pos().FindNumP(item.getString(label)));
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}


public void search(HttpServletRequest request,HttpServletResponse response){
response.sendRedirect("你的action?value="+temp);
}


取值就不用说了把。。。。。。
alen1985 2009-07-01
  • 打赏
  • 举报
回复
item.getString(label)
这个是动态的
alen1985 2009-07-01
  • 打赏
  • 举报
回复
部分代码:


public class GraphView extends JPrefuseApplet {

private static final String graph = "graph";
private static final String nodes = "graph.nodes";
private static final String edges = "graph.edges";

public void init() {
UILib.setPlatformLookAndFeel(); //�����û�������ϵͳ���ϣ�����ļ�api
JComponent graphview = demo("C://air.xml", "name"); //����xml�ļ�����name�ڵ��ȡ���õ�ͼ�ᅣ1�7
this.getContentPane().add(graphview); //��ͼ�μ��뵽swing�����ȥ��ʄ1�7
}

.....
.....
...
display.addControlListener(new ControlAdapter(){
public void itemClicked(VisualItem item, MouseEvent e) {
// TODO Auto-generated method stub
if (item.canGetString(label))

System.out.println(item.getString(label));
try {
System.out.println(new Fre_pos().FindNumP(item.getString(label)));
title.setText(new Fre_pos().FindNumP(item.getString(label)));
} catch (Exception e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
});


上面红色部分是点击了applet的节点动态获取的数据,如何传递给action?
qiheia 2009-07-01
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 alen1985 的回复:]
主要是我获取的数据在prefuse的那个applet中,是一个普通的类,并没有request或session之类的
[/Quote]
既然是个普通的类,你就将值传到action中,或者servlet中,
或者写个带3个参数的方法,然后调用下这个方法,将值传过去

public void search(HttpServletRequest request,HttpServletResponse response,List list){
//然后利用request对象保存到作用域就可以了啊,list就是你取到的值,
//这我是打个比方,你还可以传字符串,数组等等。。
}
alen1985 2009-07-01
  • 打赏
  • 举报
回复
主要是我获取的数据在prefuse的那个applet中,是一个普通的类,并没有request或session之类的
heavilyarmed 2009-07-01
  • 打赏
  • 举报
回复
这是什么,还真没用过,来看看
qiheia 2009-07-01
  • 打赏
  • 举报
回复
[Quote=引用楼主 alen1985 的帖子:]
现在我用的主要是它的GraphView图,通过点击它上面的结点,现在能获取到结点的值,但是我想把这个值传递到jsp中,该如何实现?另外:我把获取的值显示在图上的时候,中文显示的是方框乱码,该如何解决!
[/Quote]

你既然可以获取到值的话,就最好了

就把获取到的值放到作用域中session或request等

然后在jsp页面直接去取作用域中的值就可以了,建议采用EL去获取作用域中的值

显示方框,就表示为乱码,只要处理下编码格式就可以了。。。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧