You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Arpan <ar...@gmail.com> on 2012/01/21 17:22:50 UTC
child window reseting the values of parent window
Hi,
My requirement is like as follows:
User can edit fields in a page. This page will have a link, which will open
a child window, which will work independently.
The child window uses different Action classes and different submit flow
altogether.
But after closing the child window, the user can again start editing the
parent page fields and should submit also.
If I reload the parent page,while closing the child window, one pop up
warning message comes out and all the parent window field values get reset,
which are not desirable.
Can any one knows how to do it. I am using Struts1.
Thanks
Re: child window reseting the values of parent window
Posted by Arpan <ar...@gmail.com>.
Hi Piyush,
Thanks for the response.
I have just looked at the hidden field values and I have found the parent
and child generating separate token values.
Even if I just open my child window and close it immediately, the parent
form doesn't get submitted after that and gives error of duplicate
submission.
Thanks
On Thu, Jan 26, 2012 at 12:12 PM, Piyush Kumar <al...@gmail.com>wrote:
> When I mentioned "page source" in my last email, I meant the HTML source
> generated on the client side which you can see in the browser (right click
> the page and click view page source).
>
> Thanks and regards,
> Piyush
>
> On Thu, Jan 26, 2012 at 12:10 PM, Piyush Kumar <alivelove2003@gmail.com
> >wrote:
>
> > Please read my last reply and note that the hidden element may also look
> > like -
> >
> > <html:hidden name="Globals.TRANSACTION_TOKEN_KEY" scope="session" />
> >
> > in your JSP which eventually will be converted to the HTML
> >
> > <input type="hidden" ....
> >
> > which will appear in the page source. If you are getting a message that
> > the form has already been submitted, it means that you have sent another
> > request with the same token earlier. Thus, it boils down to the fact that
> > you have same tokens for the pop up and the parent. Try to change this as
> > per the scope of changes in your project.
> >
> > Piyush
> >
> > On Thu, Jan 26, 2012 at 11:45 AM, Piyush Kumar <alivelove2003@gmail.com
> >wrote:
> >
> >> There must be following in the forms on the both window.
> >>
> >> <input type="hidden"
> >> name="<%=org.apache.struts.taglib.html.Constants.TOKEN_KEY%>"
> >> value="<bean:write name="<%=Globals.TRANSACTION_TOKEN_KEY%>"/>">
> >>
> >> When the pop up appears, find the above described element in the page
> >> source, you will find that on both the page such elements are identical,
> >> which is not desirable. For every request new token is generated and
> stored
> >> as a session attribute with the key Globals.TRANSACTION_TOKEN_KEY. We
> >> have to make sure that this generated token is different for the parent
> and
> >> the child window.
> >>
> >> Since, for every request, a new token is generated by the action which
> >> renders the form, try to load the parent and the pop up through
> different
> >> actions.
> >>
> >> Think about it and reply,
> >> Piyush
> >>
> >> On Wed, Jan 25, 2012 at 10:14 PM, Arpan <ar...@gmail.com> wrote:
> >>
> >>> Actually what is happening that when my child window submits, it has a
> >>> specific struts token.
> >>> When I close the child and try to submit the parent window, it shows
> that
> >>> the form has already been submitted.
> >>> So can any one know, how to solve this problem.
> >>>
> >>> Thanks
> >>>
> >>>
> >>> On Mon, Jan 23, 2012 at 12:56 AM, Arpan <ar...@gmail.com>
> wrote:
> >>>
> >>> > Hi Piyush,
> >>> >
> >>> > If I close my child window and try to submit the parent one, submit
> >>> button
> >>> > doesn't work.
> >>> > There's no JS error shown in the browser.
> >>> > But if I reload the parent window,submit button works .
> >>> >
> >>> > Thanks
> >>> >
> >>> >
> >>> >
> >>> > On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <
> alivelove2003@gmail.com
> >>> >wrote:
> >>> >
> >>> >> why are you reloading the parent window on child window close. i
> think
> >>> >> your
> >>> >> problem can be solved with pure javascript. please describe it more.
> >>> >>
> >>> >> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com>
> >>> wrote:
> >>> >>
> >>> >> > Hi,
> >>> >> >
> >>> >> > My requirement is like as follows:
> >>> >> >
> >>> >> > User can edit fields in a page. This page will have a link, which
> >>> will
> >>> >> open
> >>> >> > a child window, which will work independently.
> >>> >> > The child window uses different Action classes and different
> submit
> >>> flow
> >>> >> > altogether.
> >>> >> >
> >>> >> > But after closing the child window, the user can again start
> >>> editing the
> >>> >> > parent page fields and should submit also.
> >>> >> >
> >>> >> > If I reload the parent page,while closing the child window, one
> pop
> >>> up
> >>> >> > warning message comes out and all the parent window field values
> get
> >>> >> reset,
> >>> >> > which are not desirable.
> >>> >> >
> >>> >> > Can any one knows how to do it. I am using Struts1.
> >>> >> >
> >>> >> > Thanks
> >>> >> >
> >>> >>
> >>> >
> >>> >
> >>>
> >>
> >>
> >
>
Re: child window reseting the values of parent window
Posted by Piyush Kumar <al...@gmail.com>.
When I mentioned "page source" in my last email, I meant the HTML source
generated on the client side which you can see in the browser (right click
the page and click view page source).
Thanks and regards,
Piyush
On Thu, Jan 26, 2012 at 12:10 PM, Piyush Kumar <al...@gmail.com>wrote:
> Please read my last reply and note that the hidden element may also look
> like -
>
> <html:hidden name="Globals.TRANSACTION_TOKEN_KEY" scope="session" />
>
> in your JSP which eventually will be converted to the HTML
>
> <input type="hidden" ....
>
> which will appear in the page source. If you are getting a message that
> the form has already been submitted, it means that you have sent another
> request with the same token earlier. Thus, it boils down to the fact that
> you have same tokens for the pop up and the parent. Try to change this as
> per the scope of changes in your project.
>
> Piyush
>
> On Thu, Jan 26, 2012 at 11:45 AM, Piyush Kumar <al...@gmail.com>wrote:
>
>> There must be following in the forms on the both window.
>>
>> <input type="hidden"
>> name="<%=org.apache.struts.taglib.html.Constants.TOKEN_KEY%>"
>> value="<bean:write name="<%=Globals.TRANSACTION_TOKEN_KEY%>"/>">
>>
>> When the pop up appears, find the above described element in the page
>> source, you will find that on both the page such elements are identical,
>> which is not desirable. For every request new token is generated and stored
>> as a session attribute with the key Globals.TRANSACTION_TOKEN_KEY. We
>> have to make sure that this generated token is different for the parent and
>> the child window.
>>
>> Since, for every request, a new token is generated by the action which
>> renders the form, try to load the parent and the pop up through different
>> actions.
>>
>> Think about it and reply,
>> Piyush
>>
>> On Wed, Jan 25, 2012 at 10:14 PM, Arpan <ar...@gmail.com> wrote:
>>
>>> Actually what is happening that when my child window submits, it has a
>>> specific struts token.
>>> When I close the child and try to submit the parent window, it shows that
>>> the form has already been submitted.
>>> So can any one know, how to solve this problem.
>>>
>>> Thanks
>>>
>>>
>>> On Mon, Jan 23, 2012 at 12:56 AM, Arpan <ar...@gmail.com> wrote:
>>>
>>> > Hi Piyush,
>>> >
>>> > If I close my child window and try to submit the parent one, submit
>>> button
>>> > doesn't work.
>>> > There's no JS error shown in the browser.
>>> > But if I reload the parent window,submit button works .
>>> >
>>> > Thanks
>>> >
>>> >
>>> >
>>> > On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <alivelove2003@gmail.com
>>> >wrote:
>>> >
>>> >> why are you reloading the parent window on child window close. i think
>>> >> your
>>> >> problem can be solved with pure javascript. please describe it more.
>>> >>
>>> >> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com>
>>> wrote:
>>> >>
>>> >> > Hi,
>>> >> >
>>> >> > My requirement is like as follows:
>>> >> >
>>> >> > User can edit fields in a page. This page will have a link, which
>>> will
>>> >> open
>>> >> > a child window, which will work independently.
>>> >> > The child window uses different Action classes and different submit
>>> flow
>>> >> > altogether.
>>> >> >
>>> >> > But after closing the child window, the user can again start
>>> editing the
>>> >> > parent page fields and should submit also.
>>> >> >
>>> >> > If I reload the parent page,while closing the child window, one pop
>>> up
>>> >> > warning message comes out and all the parent window field values get
>>> >> reset,
>>> >> > which are not desirable.
>>> >> >
>>> >> > Can any one knows how to do it. I am using Struts1.
>>> >> >
>>> >> > Thanks
>>> >> >
>>> >>
>>> >
>>> >
>>>
>>
>>
>
Re: child window reseting the values of parent window
Posted by Piyush Kumar <al...@gmail.com>.
Please read my last reply and note that the hidden element may also look
like -
<html:hidden name="Globals.TRANSACTION_TOKEN_KEY" scope="session" />
in your JSP which eventually will be converted to the HTML
<input type="hidden" ....
which will appear in the page source. If you are getting a message that
the form has already been submitted, it means that you have sent another
request with the same token earlier. Thus, it boils down to the fact that
you have same tokens for the pop up and the parent. Try to change this as
per the scope of changes in your project.
Piyush
On Thu, Jan 26, 2012 at 11:45 AM, Piyush Kumar <al...@gmail.com>wrote:
> There must be following in the forms on the both window.
>
> <input type="hidden"
> name="<%=org.apache.struts.taglib.html.Constants.TOKEN_KEY%>"
> value="<bean:write name="<%=Globals.TRANSACTION_TOKEN_KEY%>"/>">
>
> When the pop up appears, find the above described element in the page
> source, you will find that on both the page such elements are identical,
> which is not desirable. For every request new token is generated and stored
> as a session attribute with the key Globals.TRANSACTION_TOKEN_KEY. We
> have to make sure that this generated token is different for the parent and
> the child window.
>
> Since, for every request, a new token is generated by the action which
> renders the form, try to load the parent and the pop up through different
> actions.
>
> Think about it and reply,
> Piyush
>
> On Wed, Jan 25, 2012 at 10:14 PM, Arpan <ar...@gmail.com> wrote:
>
>> Actually what is happening that when my child window submits, it has a
>> specific struts token.
>> When I close the child and try to submit the parent window, it shows that
>> the form has already been submitted.
>> So can any one know, how to solve this problem.
>>
>> Thanks
>>
>>
>> On Mon, Jan 23, 2012 at 12:56 AM, Arpan <ar...@gmail.com> wrote:
>>
>> > Hi Piyush,
>> >
>> > If I close my child window and try to submit the parent one, submit
>> button
>> > doesn't work.
>> > There's no JS error shown in the browser.
>> > But if I reload the parent window,submit button works .
>> >
>> > Thanks
>> >
>> >
>> >
>> > On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <alivelove2003@gmail.com
>> >wrote:
>> >
>> >> why are you reloading the parent window on child window close. i think
>> >> your
>> >> problem can be solved with pure javascript. please describe it more.
>> >>
>> >> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com> wrote:
>> >>
>> >> > Hi,
>> >> >
>> >> > My requirement is like as follows:
>> >> >
>> >> > User can edit fields in a page. This page will have a link, which
>> will
>> >> open
>> >> > a child window, which will work independently.
>> >> > The child window uses different Action classes and different submit
>> flow
>> >> > altogether.
>> >> >
>> >> > But after closing the child window, the user can again start editing
>> the
>> >> > parent page fields and should submit also.
>> >> >
>> >> > If I reload the parent page,while closing the child window, one pop
>> up
>> >> > warning message comes out and all the parent window field values get
>> >> reset,
>> >> > which are not desirable.
>> >> >
>> >> > Can any one knows how to do it. I am using Struts1.
>> >> >
>> >> > Thanks
>> >> >
>> >>
>> >
>> >
>>
>
>
Re: child window reseting the values of parent window
Posted by Piyush Kumar <al...@gmail.com>.
There must be following in the forms on the both window.
<input type="hidden"
name="<%=org.apache.struts.taglib.html.Constants.TOKEN_KEY%>"
value="<bean:write name="<%=Globals.TRANSACTION_TOKEN_KEY%>"/>">
When the pop up appears, find the above described element in the page
source, you will find that on both the page such elements are identical,
which is not desirable. For every request new token is generated and stored
as a session attribute with the key Globals.TRANSACTION_TOKEN_KEY. We have
to make sure that this generated token is different for the parent and the
child window.
Since, for every request, a new token is generated by the action which
renders the form, try to load the parent and the pop up through different
actions.
Think about it and reply,
Piyush
On Wed, Jan 25, 2012 at 10:14 PM, Arpan <ar...@gmail.com> wrote:
> Actually what is happening that when my child window submits, it has a
> specific struts token.
> When I close the child and try to submit the parent window, it shows that
> the form has already been submitted.
> So can any one know, how to solve this problem.
>
> Thanks
>
>
> On Mon, Jan 23, 2012 at 12:56 AM, Arpan <ar...@gmail.com> wrote:
>
> > Hi Piyush,
> >
> > If I close my child window and try to submit the parent one, submit
> button
> > doesn't work.
> > There's no JS error shown in the browser.
> > But if I reload the parent window,submit button works .
> >
> > Thanks
> >
> >
> >
> > On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <alivelove2003@gmail.com
> >wrote:
> >
> >> why are you reloading the parent window on child window close. i think
> >> your
> >> problem can be solved with pure javascript. please describe it more.
> >>
> >> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com> wrote:
> >>
> >> > Hi,
> >> >
> >> > My requirement is like as follows:
> >> >
> >> > User can edit fields in a page. This page will have a link, which will
> >> open
> >> > a child window, which will work independently.
> >> > The child window uses different Action classes and different submit
> flow
> >> > altogether.
> >> >
> >> > But after closing the child window, the user can again start editing
> the
> >> > parent page fields and should submit also.
> >> >
> >> > If I reload the parent page,while closing the child window, one pop up
> >> > warning message comes out and all the parent window field values get
> >> reset,
> >> > which are not desirable.
> >> >
> >> > Can any one knows how to do it. I am using Struts1.
> >> >
> >> > Thanks
> >> >
> >>
> >
> >
>
Re: child window reseting the values of parent window
Posted by Arpan <ar...@gmail.com>.
Actually what is happening that when my child window submits, it has a
specific struts token.
When I close the child and try to submit the parent window, it shows that
the form has already been submitted.
So can any one know, how to solve this problem.
Thanks
On Mon, Jan 23, 2012 at 12:56 AM, Arpan <ar...@gmail.com> wrote:
> Hi Piyush,
>
> If I close my child window and try to submit the parent one, submit button
> doesn't work.
> There's no JS error shown in the browser.
> But if I reload the parent window,submit button works .
>
> Thanks
>
>
>
> On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <al...@gmail.com>wrote:
>
>> why are you reloading the parent window on child window close. i think
>> your
>> problem can be solved with pure javascript. please describe it more.
>>
>> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com> wrote:
>>
>> > Hi,
>> >
>> > My requirement is like as follows:
>> >
>> > User can edit fields in a page. This page will have a link, which will
>> open
>> > a child window, which will work independently.
>> > The child window uses different Action classes and different submit flow
>> > altogether.
>> >
>> > But after closing the child window, the user can again start editing the
>> > parent page fields and should submit also.
>> >
>> > If I reload the parent page,while closing the child window, one pop up
>> > warning message comes out and all the parent window field values get
>> reset,
>> > which are not desirable.
>> >
>> > Can any one knows how to do it. I am using Struts1.
>> >
>> > Thanks
>> >
>>
>
>
Re: child window reseting the values of parent window
Posted by Arpan <ar...@gmail.com>.
Hi Piyush,
If I close my child window and try to submit the parent one, submit button
doesn't work.
There's no JS error shown in the browser.
But if I reload the parent window,submit button works .
Thanks
On Sun, Jan 22, 2012 at 1:58 PM, Piyush Kumar <al...@gmail.com>wrote:
> why are you reloading the parent window on child window close. i think your
> problem can be solved with pure javascript. please describe it more.
>
> On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com> wrote:
>
> > Hi,
> >
> > My requirement is like as follows:
> >
> > User can edit fields in a page. This page will have a link, which will
> open
> > a child window, which will work independently.
> > The child window uses different Action classes and different submit flow
> > altogether.
> >
> > But after closing the child window, the user can again start editing the
> > parent page fields and should submit also.
> >
> > If I reload the parent page,while closing the child window, one pop up
> > warning message comes out and all the parent window field values get
> reset,
> > which are not desirable.
> >
> > Can any one knows how to do it. I am using Struts1.
> >
> > Thanks
> >
>
Re: child window reseting the values of parent window
Posted by Piyush Kumar <al...@gmail.com>.
why are you reloading the parent window on child window close. i think your
problem can be solved with pure javascript. please describe it more.
On Sat, Jan 21, 2012 at 9:52 PM, Arpan <ar...@gmail.com> wrote:
> Hi,
>
> My requirement is like as follows:
>
> User can edit fields in a page. This page will have a link, which will open
> a child window, which will work independently.
> The child window uses different Action classes and different submit flow
> altogether.
>
> But after closing the child window, the user can again start editing the
> parent page fields and should submit also.
>
> If I reload the parent page,while closing the child window, one pop up
> warning message comes out and all the parent window field values get reset,
> which are not desirable.
>
> Can any one knows how to do it. I am using Struts1.
>
> Thanks
>