user2444474
user2444474

Reputation: 573

How to maintain a popup window after submitting an action form in Struts 2?

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

I have created the another form in same JSP page, and have the action button to connect to 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 submitting the popup window by a 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 an 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 gave the return as "xxx", but it's closing the popup window. But I need to maintain the popup window after submitting the button.

Upvotes: -1

Views: 2584

Answers (1)

Roman C
Roman C

Reputation: 1

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>

Upvotes: 0

Related Questions