Thanks everyone for help and suggestions...  Sadly enough I was thinking
about this last night, and it took me ages to go to sleep!!!

What you suggest, Wendy, is what I should (and wanted to) do, but I just
don't know how to...

Basically, my action form has 4 modes: ADD, EDIT, DELETE and DISPLAY (the
difference between EDIT and DISPLAY being that edit updates the result set
and display just sets the values to edit in the DynaActionForm).

Adding and deleting and editing works (worked, until I started displaying
the values for that row) fine.  I have this show_data.jsp page controlling
the actions, such that when I want to delete i set the MODE property as
below: (deletion is done via checkboxes)

<html:hidden property="<%= Constants.MODE %>" value="<%= Constants.DELETE
%>" />

or
<html:hidden property="<%= Constants.MODE %>" value="<%= Constants.EDIT %>"
/>
<html:hidden property="<%= Constants.ROW %>" value="<%=
request.getParameter("EditRow"); %>" />
(which is set when I open 'edit_data.jsp', which is where I'm having
problems - I open it by clicking on hyperlink)

or
<html:hidden property="<%= Constants.MODE %>" value="<%= Constants.ADD %>"
/>
(which is set when I open 'add_data.jsp', this gets opened when new button
is hit and that invokes the New() function)

(so, when I invoke mydataAction the relevant action is taken based on MODE.)

The problem (and is purely due to my lack of experience with Javascript, I
believe) begins when I want to edit.  To edit the user clicks on a hyperlink
on the main page.  So, I have in my show_data.jsp something like:

    function New()
    {
        window.open("/pages/new.jsp","new", "width=380px,height=300px").focus();
    }

    function Delete()
    {
           for( n=0; document.forms[0].elements[n] != null; n++)
                {
                        if( document.forms[0].elements[n].type == "checkbox" )
                        {
                                if( document.forms[0].elements[n].checked == true )
                                {
                                        document.forms[0].submit();
                                }
                        }
                }
        }

        function Edit(row)
        {
                // How I was trying to do it:
                //editUrl = "pages/edit_data.jsp?EditRow=" + row;
                //window.open(editUrl, "scope", "width=380px,height=300px").focus();

                // How I was doing it before and am now trying to do again...
                <%
                  request.setAttribute(DiscoConstants.MODE, DiscoConstants.DISPLAY);
                  // Note that I would also like to 
'request.setAttribute(Constants.ROW,
row);' but that fails
                // Is it possible to do that at all?
                  // that's why I ended up doing things the other way, I couldn't get 
it
working this way...
                %>
                documents.forms[0].submit();
        }

Maybe this is too complicated to work out over email... :-/

Another thing I might be doing wrong:
Is <html:hidden property="<%= Constants.MODE %>" value="<%= Constants.EDIT
%>" />
equivalent to <% request.setAttribute(DiscoConstants.MODE,
DiscoConstants.EDIT); %>
My instincts led me to believe they are, but they might not be at all...
????

-----Original Message-----
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: 24 February 2004 18:09
To: Struts Users Mailing List
Subject: RE: ActionForward and onLoad()


> From: Leticia Golubov [mailto:[EMAIL PROTECTED]
> 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...

Are you letting people visit the JSP directly?  If you make them go
through the Action first, then you can set up the values in advance, and
they will be there in the session (or request) when you get to the JSP.

But I didn't really understand what you're trying to do.  Is it like a
list of catalog items, and clicking on one of them opens a smaller
window with details?

--
Wendy Smoak
Application Systems Analyst, Sr.
ASU IA Information Resources Management

---------------------------------------------------------------------
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]

Reply via email to