Pass the values back by returning a body tag from a servlet with an onload function, I've done this by generating an iframe in javascript, and the servlet when its done its stuff returns
if(isDone()) {
response.write("<body onload=\"myfunction()\">");
}
But passing back anything more than a boolean i think would border on insanity, albeit theoretically possible.
Basically set up your send and respond javascripts and toy around with load data into jsp's and executing your javascript functions when all is done.
You;ll need to clone your forms and use javascript to populate the target form via an iframe or window (i hate the window idea). Drill through the frame/windows to the relevant forms (you'll probably want to write a library to make things maintainable).
Basically you use a hidden form as a map.
On 24 Feb 2004, at 19:23, Leticia Golubov wrote:
maybe you are right...
What I'm trying to do is:
I have some data which I'm displaying on a jsp page.
This particular bit of work relates to editing a value being displayed on a
table. When I click on the <html:link> i retrieve the row number which I'm
trying to edit, pass it to the EditAction class, which then retrieves that
row's data from the result set, and sets the attributes (as defined in
struts-config.xml) which I want to display. this Action then sets the
mapping.findForward to that same page, so that I can then, edit the row.
Initially I was doing all the work in the jsp file, but there was a lot of
source code in there, so I decided to set some attributes using an Action
class and then forwarding to the same page to display those values, ready
for editing. This, of course, is also more appropriate, as it's a bad idea
to have lots of Java code in the jsp page, and I have generally been keeping
the Data access stuff at the back end (in the action classes and the data
access classes).
Once those values are shown, the user can edit them, and clicking on the OK
button triggers another submit, which this time will once again set the
attributes (I'm using DynaActionForm as my form) and then the back end
updates the result set.
All of this worked, until I decided to use attributes to send the data 'the
other way'. Does the data only flow one way? I've been experiment with
this all day and it does seem to work (well, it does set/retrieve the data
correctly), the only problem is avoiding the form being submited on and
on...
I think I do understand the MVC architecture, what I'm not very good at is
Javascript...
-----Original Message----- From: Paul McCulloch [mailto:[EMAIL PROTECTED] Sent: 24 February 2004 18:06 To: 'Struts Users Mailing List' Subject: RE: ActionForward and onLoad()
I'm a bit confused by what you are trying to do.
I have a jsp page which I need to retrieve some values at onLoad time, i.e.: <body onload="javascript:getValues();">
If you need to retrieve values then do that in the Action and put them
somewhere (e.g. a request scope attribute) so that you can access them in
your jsp.
It *sounds* like you could do with reading up on the basics of MVC in a web
environment..
Paul
-----Original Message----- From: Leticia Golubov [mailto:[EMAIL PROTECTED] Sent: 24 February 2004 17:37 To: Struts Users Mailing List Subject: RE: ActionForward and onLoad()
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:[EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
**************************************
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code. You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail. Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

