struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brandon Goodin" <m...@phase.ws>
Subject RE: Controller and Actions
Date Mon, 07 Jul 2003 15:44:02 GMT
The FormBean is reusable across several actions. If you notice in the
struts-config.xml there is a <form-bean> tag that can be used by several
actions.

But, in the manner you are referring I think the LookupDispatchAction may be
what you would want to use. It allows you to map button names to methods
within an extended LookupDispatchAction. For example, when you click the
button named "Save" on the form a key is looked up to see which method the
button maps to in the LookupDispatchAction. The method in your extended
LookupDispatchAction is then called. You can use this to accomplish CRUD
operations using  single form. It's analogous to grouping several Actions
into one for the sake of grouping functionality.

http://jakarta.apache.org/struts/api/org/apache/struts/actions/LookupDispatc
hAction.html

Brandon Goodin

hi folks,
i am working on a project right now for which i figured out struts to be
perfectly suitable. but as i looked at it a little closer i saw some
issues in the "struts way" i don't agree with. the main problem is that
you think of a 1-to-1 relation between a form and an action (i think so
'cause you send a form to an (action-)controller that handles the params
and passes them to one action).

i would say there could be various
actions on one form. you can have several submit-buttons each considered
as a separate action. so the action to be performed should be determined
by the value of the submit-button.

the other thing i would expect is a 1-to-n relation between (what i
refere to as controller) a controller that handles form-data and views.
so the process would be:
1. user sends data to controller
2. controller sets up form-bean and tells the form-bean to validate it self
3. controller desides which action is to be performed behalf of the
pressed submit-button
4. action returns or fails whith an exception
5.1. on success tell form-bean to reload data and pass controll to the
appropriate view
5.2. on failure don't reload form and pass controll to the appropriate
view (to be descided on the exception)
6. view sends new content

the point i came to this suggestion is, i have to deal with barrier-free
internet (eg lynx-compatible sites). shure you can change the location
the form is sent to by using JavaScript but not so in lynx.

so am i completely wrong with my point of view? i would luv to know.
DeeasS

--
Sind Sie auch schon drin??
Wir bieten Lösungen rund ums Internet ...

Daniel Steudel
@-traction GbR - Informations- und Kommunikationssysteme

www.attraction.de

Leiterweg 43
71254 Ditzingen

Telefon (07156) 959202
Fax (07156) 959201
Mobil (0160) 7 774 271




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



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


Mime
View raw message