I've been lurking on this list for a while, and I
finally have time to look hard at Struts for a web
application that I'm working on. I have a coupla
questions.. 1. This first question I found reference
to in the archives
(http://www.mail-archive.com/struts-user@jakarta.apache.org/msg18281.html)
but couldn't find an answer. In the application I'm
working on the business logic is already written and
is being added to by another team (it's supporting
other applications besides the web). So I've got a
whole slew of JavaBeans (100+) already written for me,
but now I'm facing the task of wrapping them in
ActionForm subclasses, cursing under my breath that it
isn't an interface. I understand that the purpose of
the ActionForm is as a buffer..perform validation and
all that. But my beans already contain the validation!
Besides, performing the validation in the ActionForm
is effectively tying business logic (data validation)
to the web framework dontya think? Rules such as no
invoice numbers under 1000 (Ted's example) should be
handled by the business logic, and given my situation
(probably a common one), this logic needs to be shared
between applications. I can't go into the server
system and fit ActionForm into the class heirarchy,
but I sure could have thrown an interface in there.
Input on this is appreciated. 2. This has to have come
up before, but I couldn't find any references. All of
my JavaBeans map to persistent components, all of
which have id's. I've written some actions to display
lists of these components and the like and everything
works great. I also started to try the Add/Edit/Save
pattern, which occurs everywhere in the app, and I'm
having a problem with the Save action. The issue is
that I need to retrieve the object from the datastore
(using the id) *before* the ActionForm is populated
with the request parameters. What I'd like is to have
the bean populated from the database, and then any
parameters that are present on the request object set
on the bean, then persist. I can't figure out how to
initialize the bean to the datastore before it gets to
me in the Action. If I make the ActionForm session
scoped, it works great...is this the common practice?
If so, how is cleanup performed? IE, user clicks to
Edit Widget 137, my EditWidgetAction class populates
WidgetForm and sticks it in the session, the user
never submits the form and goes to a different section
of the site. How would I get the bean out of the
session? Any help is appreciated. -jon

__________________________________________________
Do You Yahoo!?
Send your FREE holiday greetings online!
http://greetings.yahoo.com

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to