在jsp中使用jsf创建弹出窗口 [英] create a popup using jsf in a jsp

查看:224
本文介绍了在jsp中使用jsf创建弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用带有jsp页面的JSF 2.0进行注册. 我的页面有几个输入字段,一旦用户输入了所有数据并单击提交"按钮,就必须使用用户输入的数据来更新数据库.我想在此处生成一个弹出窗口,说明注册完成,您的参考ID为00001",其中参考ID来自后端.

I'm trying to make a registration application using JSF 2.0 with jsp as pages. My page has several input fields, once the user enters all the data and clicks on the submit button, database has to be updated with user entered data. I want to generate a popup window here stating that "REGISTRATION COMPLETE, your REFERENCE ID is 00001" where the reference ID is from back end.

这是我尝试过的代码

<h:commandButton id="submitBtn" value="Submit" action="#{regBean.submitDetails}" onclick="javascript:popUp('registrationNum.jsp')" />

registrationNum.jsp

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">        
    </head>
    <body>
    <f:view>
        <h:panelGrid>
            <f:facet name="header">              
                <h:outputText value="#{regBean.regNum}" ></h:outputText>
            </f:facet>
        </h:panelGrid>
    </f:view>
    </body>
</html>

但是我无法显示registrationNum.jsp.

推荐答案

  • 创建注册视图(jsp或XHTML),包括您的字段
  • 调用注册按钮上的操作
  • 进行实际处理
  • 如果操作成功,则将用户导航到其他页面,否则将用户引导到同一页面并显示错误消息
  • 如果成功,则在托管bean中设置已处理的ref
  • 在成功视图上,使用任何对话框(javascript,rich:modalpanel)显示警报消息
    • Create an Registration view ( jsp or XHTML), including your fields
    • Invoke an action on registration button click
    • Do the processing in action
    • Navigate user to some other page if its successful , else put user to same page with error message
    • if its successful then set the processed ref Id in managed bean
    • on success view use any dialog (javascript, rich:modalpanel) to show the alert message
    • 这篇关于在jsp中使用jsf创建弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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