14, 2002 8:44 PM
To: 'Struts Users Mailing List'
Subject: RE: ActionForm Defaults/Updates Question
Here is what I do.
User (Generic Value Object)
UserBean (Extends form bean)
On initial page we have a link to viewUser.do?userId=100
In the Action class correspoding to viewUser.do, in the perform
That's what I do to.
Putting initialisation logic (like setting defaults) in the
form makes it a
very strange object. Partly a Utility for passing data
between Forms Action
classes partly a controller fetching data from the model to make it
accessible to the JSP. The second part there
I don't use validate(). The only validation I have is in the business logic.
The business class that does validation accepts returns a string version of
the data (as well as the proper data type).
validate() introduces a new element of execution flow into the design
(validation occurs in 2 diff.
If validation fails, the controller forwards to the input property,
which can be an action that populates any static properties on the
action form bean.
Ronald Haring wrote:
That's what I do to.
Putting initialisation logic (like setting defaults) in the
form makes it a
very strange
[EMAIL PROTECTED] wrote:
1. What is the best way to load default values into an ActionForm bean that
will show up the first time a user visits the site and pulls up a jsp page?
You know, this question has come up a bunch of times, but I've never seen any
good responses.
If I've got a form in
-Original Message-
From: Mark Woon [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 4:22 PM
To: Struts Users Mailing List
Subject: Re: ActionForm Defaults/Updates Question
[EMAIL PROTECTED] wrote:
1. What is the best way to load default values into an ActionForm bean
that
will show up
The best approach is to never let the user go directly to a JSP page.
Always pass control through an Action first, which gives you the
opportunity to pre-populate forms, and a number of any other things.
To prime the pump, you can have the index.jsp forward to an Action.
After that it should
]
nford.EDU cc:
Subject: Re: ActionForm
Defaults/Updates Question
02/14/02 02:22 PM
[EMAIL PROTECTED] wrote:
In the end, I've just grabbed the Form bean from the pageContext
Pardon my ignorance but can you tell me the syntax in your JSP page to do
just that above?I think I'll need to be doing the same thing.
%
MyForm form = (MyForm)pageContext.getAttribute(form_name,
()%/
..
..
/html:form
-JC
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 6:52 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]
Subject: Re: ActionForm Defaults/Updates Question
In the end, I've just grabbed
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 14, 2002 6:52 PM
To: Struts Users Mailing List
Cc: [EMAIL PROTECTED]
Subject: Re: ActionForm Defaults/Updates Question
In the end, I've just grabbed the Form bean from the pageContext
Pardon my
snip /
I use reset() to provide all 'best guess' defaults. Within reset(), I
do not do any checks as to the input path, etc. -- strictly stateless
initialization. All other defaults initialization is either done by
the Session bean by the return of the VO to my
12 matches
Mail list logo