2010-12-06 98 views
0

我有一个小程序,调用一个URL,用户操作,并传递一些参数。这些参数在ROR服务器上执行,然后基于结果更新Applet页面上的部分。但是,部分不会更新。小应用程序的web应用程序交互

控制台说部分呈现,但它不是。是因为我从小应用程序调用URL并且服务器不知道小应用程序在当前会话中,因此它不知道要渲染哪个会话部分?

这里是控制器的代码:

def add_point 
@comments = Comment.find(:all) 
render :update do |page| 
    page[:comment_text].value = "" 
    page.replace_html :comments_partial, :partial => 'comments', :collections=>@comments 
end 
end 

编辑:我使用Apache公地HTTP包装发送请求:

PostMethod post = new PostMethod("http://localhost:3001/vizs/add_point"); 

post.addParameter("upload[test]", dataImg); 
post.addParameter("upload[user_id]", new Integer(user_id).toString()); 
post.addParameter("upload[viz_id]", new Integer(viz_id).toString()); 

我想我需要设置额外的请求变量,但我我不确定要设置什么......

有关如何解决此问题的任何建议?

感谢,

Slotishtype

回答

0

轨不知道对小程序,不知道如何使用它,你需要发送XML或JSON,甚至HTML:

def add_point 
@comments = Comment.find(:all) 
render :partial => 'comments', :collections=>@comments, :layout => nil 
end 

解析它在applet中并自己填写适当的字段。

+0

感谢您的回复,我想我需要在applet中设置一个请求变量,但我不确定要设置什么。我使用apache commons http来封装请求(请参阅更新后的问题)。你知道我必须设置什么吗? – slotishtype 2010-12-06 14:28:44

相关问题