Note that there are some explanatory texts on larger screens.

plurals
  1. POAvoid Action execution twice in struts2
    primarykey
    data
    text
    <p>I am using Struts 2 with tiles for my application. </p> <p>In the application i am using an action class say <strong>'A'</strong> with different action methods like <em>add</em>,*edit*,<em>save</em>,*savesuccess* and so on.<br/><br> In a page, when i am clicking a check box ,i use window.open method to open a pop-up window by calling a action method "edit()" of the action class A which performs some database operation and return the result to the pop-window.<br/> After performing some modification i submit the form to a action method named "save()" in action class A and it return the result page to the same pop-window.<br/> The problem is when i close the pop-window, the action is executed once again and shows null values in console and exception.<br/>I thought it may be due to browser so i try the <strong>event.returnValue=false</strong> on click event in the pop-window but still i am facing the problem.<br> I came to know about the token interceptor in struts2. But when i am using tag in the page , it shows 404 error.<br/>I will be thankful to those who provide some examples related to using token Interceptor in struts2 with tiles.. <br/> Struts.xml</p> <pre><code>&lt;action name="*Com" method="{1}" class="com.act.A"&gt; &lt;result name="add" type="tiles"&gt;add&lt;/result&gt; &lt;result name="edit" type="tiles"&gt;edit&lt;/result&gt; &lt;result name="save" type="tiles"&gt;save&lt;/result&gt; &lt;result name="savesuccess" type="tiles"&gt;savesuccess&lt;/result&gt; </code></pre> <p> </p> <p>Parent Page pop window open code:</p> <pre><code>editwindow=window.open("editCom?id="+id+"&amp;name="+name+"..and son on","edit","width=605px,height=270px,channelmode=no,left=250px,location=no,menubar=no,status=no,titlebar=no,toolbar=no,top=250px,scrollbars=yes,resizable=no"); </code></pre> <p>Popwindow Edit window form submission code</p> <pre><code>&lt;form name="editpage" action="saveCom" method="post"&gt; .......... </code></pre> <p> </p> <p>After clicking the submit button it open a new page on the same popwindow like this</p> <pre><code>&lt;html&gt; &lt;script type="text/javascript"&gt; function check1(){ window.opener.location="savesuccessCom"; } &lt;/script&gt; &lt;body onunload="check1"&gt; &lt;form name="editsave" method="post" action="" &gt; ..... &lt;p&gt;Changes Saved Successfully&lt;/p&gt; &lt;input type="button" name="Saved" id="Save" value="Save" onclick="self.close();event.returnValue=false;"/&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Please help me to solve this issues. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload