You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Leticia Golubov <lg...@micromuse.com> on 2004/02/24 18:08:38 UTC

ActionForward and onLoad()

Hello Gurus,

I'm in a bit of a predicament, and my lack of expertise in Javascript and
Struts isn't helping... :(

I have a jsp page which I need to retrieve some values at onLoad time, i.e.:
<body onload="javascript:getValues();">

all getValues() does is submit the form on this page which sets a bunch of
bean values for me to retrieve further down this page...

The problem is, on the Action for this form, I need to redisplay the same
page... As you can imagine I find myself in a never ending onload loop using
this setup of mine...

Assuming anyone can understand my description of this situation, my question
is: how can I get a page to execute the onload first time but not to do it
second time around?  Basically, I would like the onload for that window to
be called from the parent window, but I've no idea how to do it...  I've
tried doing below from the parent window:

window.open(editUrl, "scope",
"width=380px,height=300px").onload(document.forms[0].submit());

but that didn't work, i'd imagine that submitted the current window, not the
one about to be opened.

thanks in advance

Leticia











---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ActionForward and onLoad()

Posted by Geeta Ramani <ge...@cmpco.com>.
Hi Leticia:

You're right, I don't understand your question completely (must be because I'm
no guru..;)).. But may be you can use this thought anyways: you can use a
session variable when you paint your jsp. What i mean is you can test for the
existence of this session variable and if it does not exist, add the onLoad
stuff in, if it does exist, don't.  So if when you submit the form (the first
time), you simply set that session variable, you should be home.. (this will
work assuming i understood enough o your problem in the first place!!)

Good luck!
Geeta

Leticia Golubov wrote:

> Hello Gurus,
>
> I'm in a bit of a predicament, and my lack of expertise in Javascript and
> Struts isn't helping... :(
>
> I have a jsp page which I need to retrieve some values at onLoad time, i.e.:
> <body onload="javascript:getValues();">
>
> all getValues() does is submit the form on this page which sets a bunch of
> bean values for me to retrieve further down this page...
>
> The problem is, on the Action for this form, I need to redisplay the same
> page... As you can imagine I find myself in a never ending onload loop using
> this setup of mine...
>
> Assuming anyone can understand my description of this situation, my question
> is: how can I get a page to execute the onload first time but not to do it
> second time around?  Basically, I would like the onload for that window to
> be called from the parent window, but I've no idea how to do it...  I've
> tried doing below from the parent window:
>
> window.open(editUrl, "scope",
> "width=380px,height=300px").onload(document.forms[0].submit());
>
> but that didn't work, i'd imagine that submitted the current window, not the
> one about to be opened.
>
> thanks in advance
>
> Leticia
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


RE: ActionForward and onLoad()

Posted by Leticia Golubov <lg...@micromuse.com>.
I've tried

window.open(editUrl, "scope",
"width=380px,height=300px").document.forms[0].submit();

but that doesn't behave very well...


-----Original Message-----
From: Leticia Golubov [mailto:lgolubov@micromuse.com]
Sent: 24 February 2004 17:09
To: Struts User Mailing List
Subject: ActionForward and onLoad()


Hello Gurus,

I'm in a bit of a predicament, and my lack of expertise in Javascript and
Struts isn't helping... :(

I have a jsp page which I need to retrieve some values at onLoad time, i.e.:
<body onload="javascript:getValues();">

all getValues() does is submit the form on this page which sets a bunch of
bean values for me to retrieve further down this page...

The problem is, on the Action for this form, I need to redisplay the same
page... As you can imagine I find myself in a never ending onload loop using
this setup of mine...

Assuming anyone can understand my description of this situation, my question
is: how can I get a page to execute the onload first time but not to do it
second time around?  Basically, I would like the onload for that window to
be called from the parent window, but I've no idea how to do it...  I've
tried doing below from the parent window:

window.open(editUrl, "scope",
"width=380px,height=300px").onload(document.forms[0].submit());

but that didn't work, i'd imagine that submitted the current window, not the
one about to be opened.

thanks in advance

Leticia











---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ActionForward and onLoad()

Posted by "Domingo A. Rodriguez S." <do...@yahoo.com>.
SORRRRY...


  var pass= '<%=load%>';
  if(pass=='first_time')


SORRRRY...

 --- "Domingo A. Rodriguez S." <do...@yahoo.com> escribió: > 
> <body onload="javascript:getValues();">
> 
> function getValues{
>  // sample code
>  // I would pass a hidden param 
>  <% 
>   String param= request.getParameter("myHidden");
>   String load= param==null?"first_time":"next_time";
>  %>

   var pass= '<%=load%>';
   if(pass=='first_time')
>      document.forms[0].myHidden.value='first_time';
>      document.forms[0].submit();
>   };
> }
> 
>  --- Leticia Golubov <lg...@micromuse.com> escribió: > Hello Gurus,
> > 
> > I'm in a bit of a predicament, and my lack of expertise in Javascript
> > and
> > Struts isn't helping... :(
> > 
> > I have a jsp page which I need to retrieve some values at onLoad time,
> > i.e.:
> > <body onload="javascript:getValues();">
> > 
> > all getValues() does is submit the form on this page which sets a
> bunch
> > of
> > bean values for me to retrieve further down this page...
> > 
> > The problem is, on the Action for this form, I need to redisplay the
> > same
> > page... As you can imagine I find myself in a never ending onload loop
> > using
> > this setup of mine...
> > 
> > Assuming anyone can understand my description of this situation, my
> > question
> > is: how can I get a page to execute the onload first time but not to
> do
> > it
> > second time around?  Basically, I would like the onload for that
> window
> > to
> > be called from the parent window, but I've no idea how to do it... 
> I've
> > tried doing below from the parent window:
> > 
> > window.open(editUrl, "scope",
> > "width=380px,height=300px").onload(document.forms[0].submit());
> > 
> > but that didn't work, i'd imagine that submitted the current window,
> not
> > the
> > one about to be opened.
> > 
> > thanks in advance
> > 
> > Leticia
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >  
> 
> _________________________________________________________
> Do You Yahoo!?
> Información de Estados Unidos y América Latina, en Yahoo! Noticias.
> Visítanos en http://noticias.espanol.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>  

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Re: ActionForward and onLoad()

Posted by "Domingo A. Rodriguez S." <do...@yahoo.com>.
<body onload="javascript:getValues();">

function getValues{
 // sample code
 // I would pass a hidden param 
 <% 
  String param= request.getParameter("myHidden");
  String load= param==null?"first_time":"next_time";
 %>
  var pass= document.forms[0].myHidden;
  if(pass.value=='first_time')
     document.forms[0].myHidden.value='first_time';
     document.forms[0].submit();
  };
}

 --- Leticia Golubov <lg...@micromuse.com> escribió: > Hello Gurus,
> 
> I'm in a bit of a predicament, and my lack of expertise in Javascript
> and
> Struts isn't helping... :(
> 
> I have a jsp page which I need to retrieve some values at onLoad time,
> i.e.:
> <body onload="javascript:getValues();">
> 
> all getValues() does is submit the form on this page which sets a bunch
> of
> bean values for me to retrieve further down this page...
> 
> The problem is, on the Action for this form, I need to redisplay the
> same
> page... As you can imagine I find myself in a never ending onload loop
> using
> this setup of mine...
> 
> Assuming anyone can understand my description of this situation, my
> question
> is: how can I get a page to execute the onload first time but not to do
> it
> second time around?  Basically, I would like the onload for that window
> to
> be called from the parent window, but I've no idea how to do it...  I've
> tried doing below from the parent window:
> 
> window.open(editUrl, "scope",
> "width=380px,height=300px").onload(document.forms[0].submit());
> 
> but that didn't work, i'd imagine that submitted the current window, not
> the
> one about to be opened.
> 
> thanks in advance
> 
> Leticia
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>  

_________________________________________________________
Do You Yahoo!?
Información de Estados Unidos y América Latina, en Yahoo! Noticias.
Visítanos en http://noticias.espanol.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org