struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oleg Konovalov" <olegstr...@gmail.com>
Subject Re: [OT] Re: Passing value from Struts tag in JSP to Action class
Date Mon, 13 Aug 2007 14:18:51 GMT
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") ?

Thank you,
Oleg.



On 8/12/07, Frank W. Zammetti <fzlists@omnytex.com> 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: fzammetti@hotmail.com
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message