1

我需要从我的 jsp 中显示一个弹出窗口。代码如下。

<form:form method="post" commandName="transactionDetails"
    align="center">
    <form:radiobutton path="plan" value="0" label="prepaid" />
    <form:radiobutton path="plan" value="1" label="postpaid" />
    <br>
    <br>Mobile Number : <br>
    <form:input path="mobile" />
    <br>

    <br>
     Operator <br>
    <form:select path="operator">
        <form:option value="Select operator">Select Operator</form:option>
        <form:option value='Aircel'>Aircel</form:option>
        <form:option value='Airtel'>Airtel</form:option>
        <form:option value='BSNL'>BSNL</form:option>
        <form:option value='Idea'>Idea</form:option>
        <form:option value='MTNL'>MTNL</form:option>
        <form:option value='MTS'>MTS</form:option>
        <form:option value='Loop Mobile'>Loop Mobile</form:option>
        <form:option value='Reliance CDMA'>Reliance CDMA</form:option>
        <form:option value='Reliance GSM'>Reliance GSM</form:option>
        <form:option value='S Tel'>S Tel</form:option>
        <form:option value='Tata DOCOMO'>Tata Docomo GSM</form:option>
        <form:option value='Tata Indicom'>Tata Docomo CDMA</form:option>
        <form:option value='Uninor'>Uninor</form:option>
        <form:option value='Videocon'>Videocon</form:option>
        <form:option value='Virgin GSM'>Virgin GSM</form:option>
        <form:option value='Virgin CDMA'>Virgin CDMA</form:option>
        <form:option value='Vodafone'>Vodafone</form:option>
        <form:option value='Cheers'>Cheers</form:option>
        <form:option value='Ping'>Ping</form:option>

    </form:select>
    <br>
    <br> Amount <br>: 
         <form:input path="amount" />





    <br>
    <br>
    <input type="submit" class="btn" value="Proceed to recharge">

现在,当用户单击选择运算符时,它应该显示特定运算符的计划。我正在使用弹簧 mvc。

类似于paytm..

4

1 回答 1

0

操作员调用 javascript 函数的 OnChange 为

<form:select path="operator" id="operator" onChange="SelectOperator();">         
       <form:option value="Select operator">Select Operator</form:option>         
       <form:option value='Aircel'>Aircel</form:option>         
        ......
</form:select> 

通过调用 Spring Controller 并将此运算符传递为,编写打开弹出窗口的 javascript 函数

<Script language="javascript">
function SelectOperator() {
    var opr = document.getElementById("operator").value;
    window.open("NEWPOPUP","/controllerURL?operator="+opr);
}
</script>

无论从该控制器返回哪个页面,都将作为弹出窗口打开。

于 2012-10-11T06:10:14.177 回答