0
votes

I have page which created by Struts 2 and in that page have link to open popup window which created using jQuery UI dialog model form.

I have created the another form in same JSP page and have action button to do connect the database. Now while return back, I need to maintain the same popup window in the page.

How to maintain the same popup window ?

Example :

page A (parent JSP page) has a form with action and buttons).

Now I have created another form for popup window in same JSP page with another action button.

After submit the popup window submit button, I need to maintain the same popup window.

How to achieve this ?

$( "#popup" ).click(function() {
$( "#dialog-form" ).dialog( "open" );
});

$( "#dialog-form" ).dialog({ 
 autoOpen: false,
 height: 300,
 width: 350,
 modal: true,
 buttons : {
 "Use Selected" : function(){
 
 }
 }
 
 });

Struts from:

<div id="aaa">
<form action="productxxx" methid="post">
---
 ----
</form>

<div id="dialog-form">
<form action="productfinder" method="post">
<textarea id="TextArea" name="productNbr" ><s:property value='productNbr'/></textarea>
<s:submit action="product" method="finder" value="Search" />

Form "xxx" is original form which is forwarding to another page after submitting the button. But the second form is for popup window which has a submit button.

So I'm submitting the second form button, it's searching another JSP page to forward. It is not correct because the given action class returns a type as a finder.

So I given the return as "xxx" but its closing the popup window. But I need to maintain the popup window after submitting the button.

1

1 Answers

0
votes

Use struts2-jquery plugin's <sj: submit> tag

<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<html>
  <head>
    <sj:head/>
  </head>
  <body>    
    <div id="dialog-form">
      <s:form action="product" method="post">
        <textarea id="TextArea" name="productNbr"><s:property value='productNbr'/>
        <sj:submit method="finder" value="Search" />
      </s:form>
    </div>
  </body>
</html>