You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Givler, Eric" <eg...@state.pa.us> on 2007/02/02 18:10:39 UTC

Struts 1.x Edit Button Dispatching

I have a multi-record display grid and I want the user to be able to click a button to Edit a record.  Since the page also handles Loading the records, and navigation to two other places, I was using the EventDispatchAction.

I tried mapping: event_edit{?}=Edit, but the Edit method is never invoked.  It appears that the getMethodName in eventActionDispatcher must match a request parameter exactly.  I thought from reading somewhere that Struts allowed Wildcards in Parameter entries, but I guess this doesn't apply in this case.

I cannot use Javascript to perform the function of supplying a hidden id# to a hidden field because the form must work both with or without JS enabled.

If I make my default action something that can handle these edits, how can some calling struts action invoke a forward, and pass a parameter to invoke the current default method, which is "loadDueReports"?  (that is, the default=loadDueReports exists now and I'd need something to differentiate it so it would dispatch correctly).

Does anyone have pointers on how this could be done with a button?

Thanks!  [I'm using Struts 1.3.5]

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


Re: Struts 1.x Edit Button Dispatching

Posted by Michael Jouravlev <jm...@gmail.com>.
On 2/2/07, Givler, Eric <eg...@state.pa.us> wrote:
> I have a multi-record display grid and I want the user to be able to click a button to Edit a record.  Since the page also handles Loading the records, and navigation to two other places, I was using the EventDispatchAction.
>
> I tried mapping: event_edit{?}=Edit, but the Edit method is never invoked.  It appears that the getMethodName in eventActionDispatcher must match a request parameter exactly.  I thought from reading somewhere that Struts allowed Wildcards in Parameter entries, but I guess this doesn't apply in this case.

Umm, you are right - wildcards are not supported for action events. I
suppose this should be fixed to align event handling with other types
of parameters. In the meantime, could you provide more information
about your page, maybe you don't really need wildcards.

> I cannot use Javascript to perform the function of supplying a hidden id# to a hidden field because the form must work both with or without JS enabled.

If you don't use Javascript, how do you supply id of an item to edit?
Do you have one button for the whole grid, or does each row has a
button? If you use one button, please explain how do you employ one
button without using Javascript, how do you select item to edit.

Without Javascript your task can be easily resolved with one
button/link per row in grid. Links look nicer in grid rows than
buttons ;-) If you use buttons, the simplest way is to define each row
as an HTML form. If you use links, you need to build these links so an
item id is added as parameter.

You may find this sample useful:
https://sourceforge.net/project/showfiles.php?group_id=49385&package_id=154597

Michael.

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