开发者

create a popup using jsf in a jsp

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.

Here is the code which I tried

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

The registrationNum.jsp is

<%@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">              开发者_JS百科
                <h:outputText value="#{regBean.regNum}" ></h:outputText>
            </f:facet>
        </h:panelGrid>
    </f:view>
    </body>
</html>

But I'm unable to display the registrationNum.jsp.


  • 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


Check this answer, i think that will help you out.

You cannot directly land on the pop as all the pop up needs a parent page.

So either land in a result page or in the same ppage and use the script to come up with a pop according to value set in the session , You can use a flag or even a string.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜