JSF / Applet的整合 [英] JSF / Applet integration

查看:215
本文介绍了JSF / Applet的整合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们当前的原型最标准的HTML控件由一个applet所取代,最重要的表单提交由小应用程序引起的。

In our current prototype most the standard HTML controls are replaced by an applet, most important the form submission is triggered by the applet.

有没有办法来调用服务器端相关的动作几乎相同的方式与

Is there a way to call an associated action on the server side much the same way as with

<h:commandButton action="#{ctrl.doit}"/>?

本文 Applet与JSF集成 - 例如有同样的问题,但不是合适的答案。该小程序是替代从服务器的观点来看的形式的下降。它填补专用(隐藏)字段和提交 - 没有直接沟通的服务器

This article Applet and JSF Integration - example had the same question but not a suitable answer. The applet is a drop in replacement for a form from the viewpoint of the server. It fills dedicated (hidden) fields and submits - no direct communication to a server.

修改

到目前为止,据我所知,这些集成的可能性:

So far, i understand there are these integration possibilities:


  • 添加(隐藏)UICommand并通过JavaScript触发它

  • 实施自己的UICommand。据我了解,我会定义一个隐藏的参数标记的小应用程序的提交表单控制,请求处理周期中UICommand实施将发现并触发动作。也许我们应该实现一个虚拟控制(与F:viewParam)作为MethodEx pressions端点

  • 附加一个监听器,要么是一个(随机)控制或更一般的事件侦听器和这里做你的东西。在这种情况下,怎么做导航?

推荐答案

这是不会可能的,而不必在具有嵌入式小程序非常相同的页面物理JSF视图。所以,你应该至少有一个&LT; H:形式&GT; &LT; H:的commandButton&GT; 中在同一个页面,必要时可通过CSS隐藏显示:无; 。这完全是因为JSF需要在服务器端这种形式的视图状态,等等,以prevent的 的CSRF攻击状。如果有一个物理&LT; H:形式&GT; 页面是不是对你的问题(这似乎是真实的你的尤其的情况下) ,那么你可以让小程序满山遍野(如果有的话),并使用单击窗体的按钮<一个href=\"http://download.oracle.com/javase/tutorial/deployment/applet/invokingJavaScriptFromApplet.html\"相对=nofollow>小程序的JavaScript 的沟通。

This is not possible without having a physical JSF view in the very same page which has the applet embedded. So, you should really at least have a <h:form> with a <h:commandButton> in the same page, if necessary hidden by CSS display: none;. This is simply because JSF needs to have a view state of that form in the server side, among others to prevent CSRF-like attacks. If having a physical <h:form> in the page is not a problem for you (which seems to be true in your particular case), then you can just let Applet fill the fields (if any) and click the button of the form using Applet-JavaScript communication.

除此之外,一个简单的servlet或一个真正的Web服务API喜欢JAX-RS / JAX-WS确实是最好的方式。 JSF是一个基于组件的MVC框架,而不是一个Web服务框架。这就是我在链接的问题的答案是试图弄清楚:使用正确的工具的工作

Other than that, a simple servlet or a real webservice API like JAX-RS/JAX-WS is really the best way. JSF is a component based MVC framework and not a webservice framework. That's what my answer in that linked question is trying to make clear: use the right tool for the job.

这篇关于JSF / Applet的整合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆