You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sebastian Ho <se...@bii.a-star.edu.sg> on 2004/09/13 08:59:04 UTC
Frame problem using Struts
Hi
My index.jsp has a top frame and bottom frame.
I have a html:button in the bottom frame. When the button is clicked,
Action will either forward to the same page or a different page. The
same page target will be _self which is how struts behaves.
For the other path that displays a different page, I need it to be _top
because it replaces the top frame as well.
I got stuck after my javascript attempt fails. I added
onClick-location.parent="XX.do" to my button. The action class (XX.do)
is called correctly, but no matter which actionForward my action
returns, the javascript overwrite that and forwards to XX.do!
Any idea how to solve this?
Thanks
Sebastian Ho
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Sebastian Ho <se...@bii.a-star.edu.sg>.
No..It is just a login Page. Thats why I need to change the top frame as
well to display the menu after login..
On Mon, 2004-09-13 at 15:03, Michael McGrady wrote:
> Sebastian Ho wrote:
>
> >Hi
> >
> >My index.jsp has a top frame and bottom frame.
> >
> >I have a html:button in the bottom frame. When the button is clicked,
> >Action will either forward to the same page or a different page. The
> >same page target will be _self which is how struts behaves.
> >
> >For the other path that displays a different page, I need it to be _top
> >because it replaces the top frame as well.
> >
> >I got stuck after my javascript attempt fails. I added
> >onClick-location.parent="XX.do" to my button. The action class (XX.do)
> >is called correctly, but no matter which actionForward my action
> >returns, the javascript overwrite that and forwards to XX.do!
> >
> >Any idea how to solve this?
> >
> >Thanks
> >
> >Sebastian Ho
> >
>
> Are you doing a chat or something similar? If so, I can direct you to a
> known solution in Servlets which you can then mimic.
>
> Michael
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Michael McGrady <mi...@michaelmcgrady.com>.
Sebastian Ho wrote:
>Hi
>
>My index.jsp has a top frame and bottom frame.
>
>I have a html:button in the bottom frame. When the button is clicked,
>Action will either forward to the same page or a different page. The
>same page target will be _self which is how struts behaves.
>
>For the other path that displays a different page, I need it to be _top
>because it replaces the top frame as well.
>
>I got stuck after my javascript attempt fails. I added
>onClick-location.parent="XX.do" to my button. The action class (XX.do)
>is called correctly, but no matter which actionForward my action
>returns, the javascript overwrite that and forwards to XX.do!
>
>Any idea how to solve this?
>
>Thanks
>
>Sebastian Ho
>
Are you doing a chat or something similar? If so, I can direct you to a
known solution in Servlets which you can then mimic.
Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Sebastian Ho <se...@bii.a-star.edu.sg>.
Sorry but I don't understand where is the 'dynamic targetting'. From the
example, don't we need to hard code the setDynamicTarget(XX) in the JSP?
But I won't know the taget to set at that time..
Sebastian Ho
On Mon, 2004-09-13 at 16:33, Bj wrote:
> Here is an example of dynamic targeting :-)
> By default, the target will be '_self' but depending on the clicked
> button, you can change the target to '_top','_parent',..., a frame name
> or any opended window.
> Your Action will forward your path (succes, failure,...) to the
> corresponding target window.
>
>
> <script language="JavaScript">
> function setDynamicTarget(target) {
> document.forms[0].target = target;
> }
> function SubmitForm(object) {
> object.form.submit();
> }
> </script>
>
> ...
>
> <html:frame action="XX.do" target="_self">
> ...
> <html:button property="mybouton.name" styleId="button"
> onclick="setDynamicTarget('_top');SubmitForm(this)"><bean:message
> key="mymodule.mybuttonlabel"/></html:button>
> ...
> </html:form>
>
>
> Bj
>
> Sebastian Ho a écrit :
> > When you say depending on the clicked button, are u assuming that there
> > are >1 button. I only have one button in the frame. The behaviour is
> > coded in actino class. If this is not what u meant, some pointers or
> > example will be appreciated.
> >
> > thanks
> >
> > sebastian
> >
> >
> > On Mon, 2004-09-13 at 15:26, Benjamin Letrou wrote:
> >
> >>Hi,
> >>why don't you set your target dynamicaly with a javascript ?
> >>you set your form action to XX.do and change the target depending on the
> >>clicked button.
> >>
> >>Bj
> >>
> >>Sebastian Ho a écrit :
> >>
> >>>Hi
> >>>
> >>>My index.jsp has a top frame and bottom frame.
> >>>
> >>>I have a html:button in the bottom frame. When the button is clicked,
> >>>Action will either forward to the same page or a different page. The
> >>>same page target will be _self which is how struts behaves.
> >>>
> >>>For the other path that displays a different page, I need it to be _top
> >>>because it replaces the top frame as well.
> >>>
> >>>I got stuck after my javascript attempt fails. I added
> >>>onClick-location.parent="XX.do" to my button. The action class (XX.do)
> >>>is called correctly, but no matter which actionForward my action
> >>>returns, the javascript overwrite that and forwards to XX.do!
> >>>
> >>>Any idea how to solve this?
> >>>
> >>>Thanks
> >>>
> >>>Sebastian Ho
> >>>
> >>>
> >>>---------------------------------------------------------------------
> >>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> >>>For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Bj <bj...@free.fr>.
Here is an example of dynamic targeting :-)
By default, the target will be '_self' but depending on the clicked
button, you can change the target to '_top','_parent',..., a frame name
or any opended window.
Your Action will forward your path (succes, failure,...) to the
corresponding target window.
<script language="JavaScript">
function setDynamicTarget(target) {
document.forms[0].target = target;
}
function SubmitForm(object) {
object.form.submit();
}
</script>
...
<html:frame action="XX.do" target="_self">
...
<html:button property="mybouton.name" styleId="button"
onclick="setDynamicTarget('_top');SubmitForm(this)"><bean:message
key="mymodule.mybuttonlabel"/></html:button>
...
</html:form>
Bj
Sebastian Ho a écrit :
> When you say depending on the clicked button, are u assuming that there
> are >1 button. I only have one button in the frame. The behaviour is
> coded in actino class. If this is not what u meant, some pointers or
> example will be appreciated.
>
> thanks
>
> sebastian
>
>
> On Mon, 2004-09-13 at 15:26, Benjamin Letrou wrote:
>
>>Hi,
>>why don't you set your target dynamicaly with a javascript ?
>>you set your form action to XX.do and change the target depending on the
>>clicked button.
>>
>>Bj
>>
>>Sebastian Ho a écrit :
>>
>>>Hi
>>>
>>>My index.jsp has a top frame and bottom frame.
>>>
>>>I have a html:button in the bottom frame. When the button is clicked,
>>>Action will either forward to the same page or a different page. The
>>>same page target will be _self which is how struts behaves.
>>>
>>>For the other path that displays a different page, I need it to be _top
>>>because it replaces the top frame as well.
>>>
>>>I got stuck after my javascript attempt fails. I added
>>>onClick-location.parent="XX.do" to my button. The action class (XX.do)
>>>is called correctly, but no matter which actionForward my action
>>>returns, the javascript overwrite that and forwards to XX.do!
>>>
>>>Any idea how to solve this?
>>>
>>>Thanks
>>>
>>>Sebastian Ho
>>>
>>>
>>>---------------------------------------------------------------------
>>>To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>For additional commands, e-mail: user-help@struts.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Sebastian Ho <se...@bii.a-star.edu.sg>.
When you say depending on the clicked button, are u assuming that there
are >1 button. I only have one button in the frame. The behaviour is
coded in actino class. If this is not what u meant, some pointers or
example will be appreciated.
thanks
sebastian
On Mon, 2004-09-13 at 15:26, Benjamin Letrou wrote:
> Hi,
> why don't you set your target dynamicaly with a javascript ?
> you set your form action to XX.do and change the target depending on the
> clicked button.
>
> Bj
>
> Sebastian Ho a écrit :
> > Hi
> >
> > My index.jsp has a top frame and bottom frame.
> >
> > I have a html:button in the bottom frame. When the button is clicked,
> > Action will either forward to the same page or a different page. The
> > same page target will be _self which is how struts behaves.
> >
> > For the other path that displays a different page, I need it to be _top
> > because it replaces the top frame as well.
> >
> > I got stuck after my javascript attempt fails. I added
> > onClick-location.parent="XX.do" to my button. The action class (XX.do)
> > is called correctly, but no matter which actionForward my action
> > returns, the javascript overwrite that and forwards to XX.do!
> >
> > Any idea how to solve this?
> >
> > Thanks
> >
> > Sebastian Ho
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Frame problem using Struts
Posted by Benjamin Letrou <be...@groupexm.com>.
Hi,
why don't you set your target dynamicaly with a javascript ?
you set your form action to XX.do and change the target depending on the
clicked button.
Bj
Sebastian Ho a écrit :
> Hi
>
> My index.jsp has a top frame and bottom frame.
>
> I have a html:button in the bottom frame. When the button is clicked,
> Action will either forward to the same page or a different page. The
> same page target will be _self which is how struts behaves.
>
> For the other path that displays a different page, I need it to be _top
> because it replaces the top frame as well.
>
> I got stuck after my javascript attempt fails. I added
> onClick-location.parent="XX.do" to my button. The action class (XX.do)
> is called correctly, but no matter which actionForward my action
> returns, the javascript overwrite that and forwards to XX.do!
>
> Any idea how to solve this?
>
> Thanks
>
> Sebastian Ho
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
--
Benjamin Letrou
Service infomatique
Maisons du Monde
Tél. 02.51.71.17.63
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org