执行操作并在需要时请求签名
我正在尝试开发一个组件,其中需要用户签名才能完成某个操作,这里的顺序是:
- 用户单击命令按钮或命令链接。
- 将打开一个弹出窗口,要求用户输入用户名/密码。
- 如果用户输入正确的用户名/密码,则执行原始操作。
- 如果用户输入错误的用户名/密码或单击取消按钮,则不会发生任何情况。
- 最后,当操作真正执行时,签名信息应该可用。
注意:解决方案应该是一个复合组件,应具有以下结构:
<myCC:confirm action="#{testMB.delete}" singatureType="deleteObject"/>
我为实现此行为所做的是:
创建了一个视图范围的托管 bean SignatureMB 来处理具有属性的签名 (用户名、密码和签名类型)
创建了一个请求范围的托管 Bean #{testMB} 具有映射到 #{signatureMB}
的托管属性- 我的复合组件中的 #{signatureMB}
myCC:confirm 我创建了两个链接,一个 outputLink 将打开一个带有签名表单的弹出窗口,第二个是隐藏的 commandLink,其中包含提交的真正操作,即
签名表单已发布,如果用户名/密码正确,弹出窗口将自行关闭并触发点击事件隐藏的 commandLink 的。
最后,在#{testMB.delete}中,我将获得签名信息,并能够处理该信息,完成后我将重置signatureMB中的值>.
您对这个实施有何看法?你认为有更好的方法吗?
I am trying to develop a component where a signature is requiered from a user to complete a certain operation here is the sequence:
- User clicks on a commandButton or commandLink.
- A popup opens requesting the user to enter the username/password
- If the user enters the correct username/password the original action is executed.
- If the user enters the wrong username/password or clicks the cancel button nothing happens.
- Finally when the action is really executed the signature information should be available.
Note: the solution should be a composite component that should have the following structure:
<myCC:confirm action="#{testMB.delete}" singatureType="deleteObject"/>
What I did to implement this behavior is:
Created a view scoped managed bean SignatureMB to handle the signature with the properties (username, password, and signatureType)
Created a request scoped managed bean #{testMB} with a managed property mapped to the #{signatureMB}
in my composite component myCC:confirm I created two links an outputLink that will open a popup with the signature form, the second is a hidden commandLink that will contain the real action to submit i.e. #{testMB.delete}
The signature form is posted and if the username/password are correct the popup will close itself and trigger the click event of the hidden commandLink.
Finally in the #{testMB.delete} I will have the signature information, and be able to process the information and when done I will reset the values in the signatureMB.
What do you think about this implementation? do you think there is a better way to do it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个合理的实施,也是一个良好的起点。
您将需要附加步骤 4a 来处理不正确的用户名/密码逻辑
This is a reasonable implementation and a good starting point.
You will need an addition step 4a to process the incorrect username/password logic
隐藏链接部分是“松散链接:-)”身份验证成功后,您可以自动调用删除,用户真的需要再次单击才能删除吗?另外链接可以动态呈现吗?
The hidden link part is the "loose link :-)" On successful authentication you can invoke delete automatically, would the user really need to click again to delete ? Also the link can it be rendered dynamically ?