简体   繁体   English

如何在其他jsp上的弹出框上显示表单

[英]How to display a form on popup box, which will be on other jsp

I have two jsp pages. 我有两个jsp页面。 On first page i am displaying some content and a EditButton on click of that button i have to display a form that will be coming from the second jsp. 在第一页上,我正在显示一些内容,单击该按钮时将显示一个EditButton ,我必须显示将来自第二个jsp的表单。 Can anyone please give me some example?? 任何人都可以举个例子吗? my first jsp is here 我的第一个jsp在这里

test1.jsp test1.jsp

<%@ include file="/WEB-INF/includes/includes.jsp"%>

<portlet:actionURL var="dependantModeActionUrl">
    <portlet:param name="mode" value="dependantsMode"/>
</portlet:actionURL>


<form:form id="dependentsModeForm" name="dependentsModeForm" modelAttribute="dependantsForm" method="post" action='<%=renderResponse.encodeURL(dependantModeActionUrl.toString())%>'>

<div class="cta-group pull-right">
<div id="terms" style="display:none;">
   </div>
         <button type="submit" class="cta" name="add">Add</button>
         <button type="submit" class="cta" name="edit">Edit</button>
         <button type="submit" class="cta cta--primary" name="view">View</button>
          <button type="submit" id="remove" class="cta" name="remove" >Remove</button>
          <!-- <a id="remove" href="#" onclick="removeDependants()">Remove</a> -->
          <!-- <input type="button" class="cta" onclick="loadPage()" value="Remove"/>
          <div  id='modalbox'></div> -->
         <!--  <a  href="#" onclick="openMyDialog()" >test</a> -->


   </div> 
</form:form>
<script type="text/javascript">

$(document).ready(function () {
    $(function () {
        $("#terms").dialog({

            autoOpen: false,
            modal: true,
            draggable:false,
            cache:true,
            resizable:false,
            width:'90%',
            title:'Remove Contact',
            buttons:[
                     {
                         text:'Remove',
                         class:'cta',
                         click:function(){
                             $(this).dialog('close');
                         }
                     }

                     ]

        });
    });
});

$("#remove").click(function (e) {
    e.preventDefault();
    $("#terms").dialog('open');
});
</script>

and on other side i have created a form on other 另一方面,我在另一侧创建了一个表格

test2.jsp test2.jsp

.

<html>
<head>
<title>Testtitle>
<script src="js/jquery.min.js"></script>
<link rel="stylesheet" href="/jquery_popup.css" />
<script src="/jquery_popup.js"></script>
</head>
<body>
<div id="mainform">

<div class="form" id="popup">
<p id="onclick">Popup</p>
<br/>
</div>
</div>

<!--Contact Form -->
<div id="contactdiv">
<form class="form" action="#" id="contact">
<img src="images/button_cancel.png" class="img" id="cancel"/>
<h3>Contact Form</h3>
<hr/><br/>
<label>Name: <span>*</span></label>
<br/>
<input type="text" id="name" placeholder="Name"/><br/>
<br/>
<label>Email: <span>*</span></label>
<br/>
<input type="text" id="email" placeholder="Email"/><br/>
<br/>
<label>Contact No: <span>*</span></label>
<br/>
<input type="text" id="contactno" placeholder="10 digit Mobile no."/><br/>
<br/>
<label>Message:</label>
<br/>
<textarea id="message" placeholder="Message......."></textarea><br/>
<br/>
<input type="button" id="send" value="Send"/>
<input type="button" id="cancel" value="Cancel"/>
<br/>
</form>
</div>
</form>

</div>
</body>
</html>

Now, when i click on the delete button on 现在,当我单击删除按钮

test1.jsp i can see a popup is coming but i want to display the fields on pop-up that will come from test2.jsp 我可以看到一个test1.jsp弹出窗口,但是我想在弹出窗口中显示来自test2.jsp的字段

You need to use CSS here to create div fixed on top of everything else & you can call the second JSP page inside iFrame. 您需要在这里使用CSS来创建固定在所有其他内容之上的div,并且可以在iFrame中调用第二个JSP页面。

Or better use same JSP page & show the content when button clicked using AJAX. 或者最好使用同一JSP页面并在使用AJAX单击按钮时显示内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM