>make each button on the form a submit button
I can't do it, because button has to have image, so I use <input
type=image...>
Will that work ?

Also, are you sure this    this.form.rowId.value='${list.rowId}';
will work together with my    form.action='action.do?command=notify'
I think, Javascript will get screwed up - will complain.
And I will have to make all inside a scriplet, something like:
onClick="<% form.rowId.value=<*c:out* *value=*'${list.rowId}/>;
form.action='action.do?command=notify'  %>"
Is that better ?



On 8/13/07, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
>
> Oleg Konovalov wrote:
> > No, I am not using any AJAX.
> >
> > On Submit it supposed to process that row, go to DB and refresh the
> whole
> > page,
> > so to come back on the same page.
> >
> > Also, my form is declared as <html:form>, so onClick I use
> > "form.action='action.do?command=notify'", I can't get rid of it,
> > but it doesn't want to coexist with any Javascript.
> >
> > I would not like to have multiple forms on one JSP page.
> >
> > So which of your suggestions would you recommend in my case ?
> > And how do I get a value of rowId in Action class (notify action),
> > via request.getSession().getAttribute("rowId") ?
>
> You wouldn't get it from SESSION, you'd get it from REQUEST... Unless
> your intention is to have a session-scoped ActionForm, but then you
> wouldn't get at the value as you've shown anyway (in fact, even if it's
> a request-scoped from, that's the wrong way to get the value, since your
> bypassing Struts to do it).
>
> Since you aren't using AJAX, and you want a single form, all you need to
> do is set things up in a 100% typical Struts fashion... have the HTML
> form submit to the Action you want it to, and connect an ActionForm,
> probably request-scoped, to that Action.  Make sure your ActionForm
> includes the properly named getter/setter/field for it.  Then, on your
> HTML form, add a hidden field with the name rowId, and make each button
> on the form a submit button (you can have more than one), and add an
> onClick event to it that does this:
>
> this.form.rowId.value='${list.rowId}';
>
> That should do it.  Then, in your Action you just do:
>
> String rowId = form.getRowId();
>
> ...assuming form is the name of the ActionForm parameter.  That should
> be all you need to do.
>
> Frank
>
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> AIM/Yahoo: fzammetti
> MSN: [EMAIL PROTECTED]
> Author of "Practical Ajax Projects With Java Technology"
> (2006, Apress, ISBN 1-59059-695-1)
> and "JavaScript, DOM Scripting and Ajax Projects"
> (2007, Apress, ISBN 1-59059-816-4)
> Java Web Parts - http://javawebparts.sourceforge.net
> Supplying the wheel, so you don't have to reinvent it!
>
> > Thank you,
> > Oleg.
> >
> >
> >
> > On 8/12/07, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> >> Oleg Konovalov wrote:
> >>> I have a bunch of rows [ArrayList of ValueObject Classes], and a
> button
> >>> corresponding to each row.
> >>> I populate the data from each row in forEach loop.
> >>> User is supposed to click on one of these buttons [selecting one row
> to
> >>> process],
> >>> and onClick event I need to pass the rowId of the to the new Action
> >>> ["notify"] in Action class.
> >>> Sounds like a trivial task ?
> >>> I am just not sure how to implement that correctly in Struts, pretty
> new
> >> to
> >>> Struts.
> >> Depends on what you expect to happen when they click the button... is
> >> the entire page refreshed, or are you thinking of doing some AJAX here?
> >> If the entire page is going to refresh, I'd simply make each row its
> >> own form and have the button be a regular submit button.  Add a hidden
> >> field to each form that has the rowId as its value.  Simple, standard,
> >> will work just fine.  Alternatively, if you don't like multiple forms,
> >> then have a single hidden form field which again is the row Id, then
> >> onClick of the button do:
> >>
> >> this.form.rowId.value='${list.rowId}';this.form.submit();
> >>
> >> If your thinking AJAX here, then there's all sorts of ways you could do
> >> it.
> >>
> >>> Maybe I should use
> >>> <html:submit src=pic.gif onclick="
> form.action='action.do?command=notify'"
> >> *
> >>> value*="${list.rowId}">
> >>> instead of HTML <input type=image...> ?
> >> Yes, in theory that could work, but I think it's a bit too complicated.
> >> Again, if your not thinking AJAX here, just do a plain form
> >> submission, it's the best answer.  If you DO want to do AJAX, let us
> >> know and we can suggest ways to go about it.
> >>
> >> Dave's suggestions are good too, it just comes down to how you really
> >> want this to work.
> >>
> >>> TIA,
> >>> Oleg.
> >> Frank
> >>
> >> --
> >> Frank W. Zammetti
> >> Founder and Chief Software Architect
> >> Omnytex Technologies
> >> http://www.omnytex.com
> >> AIM/Yahoo: fzammetti
> >> MSN: [EMAIL PROTECTED]
> >> Author of "Practical Ajax Projects With Java Technology"
> >> (2006, Apress, ISBN 1-59059-695-1)
> >> and "JavaScript, DOM Scripting and Ajax Projects"
> >> (2007, Apress, ISBN 1-59059-816-4)
> >> Java Web Parts - http://javawebparts.sourceforge.net
> >> Supplying the wheel, so you don't have to reinvent it!
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> > ------------------------------------------------------------------------
> >
> > No virus found in this incoming message.
> > Checked by AVG Free Edition.
> > Version: 7.5.476 / Virus Database: 269.11.15/949 - Release Date:
> 8/12/2007 11:03 AM
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to