The standard DispatchAction can be a handy way to keep various tasks
together in the same Action, where they can share code, but without
getting into kludgy performs. Dispatch lets you have a separate perform
for each task, but all in the same Action, where they can be easier to
maintain.
You dont need two actions. You can use an 'action' parameter to decide which
action you are performing.
On your html:link add a parameter action=view
and on the submit action=add or action=edit depending on what you are
doing.
In your action, you can have if statements that perform different
In reference to having two actions (create and update) instead of one combined action,
this is exactly what I have done. While the struts-example uses a parameter, I
personally prefer not to take that route.
I have simplified my code/JSPs by having each do only one thing (good OO) at the
:
Subject: RE: Struts design question
about maintenance screens
02/21/02 09:38 AM
Please respond
There are a number of ways to achieve this, and again (!) it's about choice, although
I must say this can be confusing for newbie (and experienced!) struts users.
1. 2 Actions, 1 for 'pre' and 1 for 'post' processing
2. An 'action' parameter, with switch behaviour in the action class
3.
Ghoot@PETROTECHNTo: Struts Users Mailing List
[EMAIL PROTECTED]
ICS.co.uk cc:
Subject: RE: Struts design question
about
Cc: [EMAIL PROTECTED]
Subject: RE: Struts design question about maintenance screens
Wow!
Great reply. I am saving this one.
thanks,
Theron
Emaho, Ghoot
Ghoot@PETROTECHNTo: Struts Users Mailing
List [EMAIL PROTECTED
7 matches
Mail list logo