At 11:21 PM -0500 1/15/04, Ted Husted wrote:
On Thu, 15 Jan 2004 12:14:46 -0600, Joe Germuska wrote:
 Now, at the risk of sidetracking this discussion, I have to bring
 up my other Struts pet-peeve -- the over complexity of pre-filling
 forms from data rather than from the request.  I'm wondering if
 bringing up some questions about how the form bean is looked up
 gives me a chance to scratch that itch too...?

I don't think this is what you meant, but I've wondered whether the tags should check the request for a corresponding attribute if the formbean property returns null.

Since I've adopted the "use strings as ActionForm properties", I don't have much use for this kind of solution, but it also just seems kind of complicated.


I think the trickiest bit about getting the ActionForm for prefilling involves the dependency on ActionMappings in the API around getting form instances. Right now you need an ActionMapping to get a DynaActionForm, although the mapping is just used to look up the FormBeanConfig. Someone has probably suggested this before, but what about adding a "newInstance()" method to FormBeanConfig?

From there, one could create an alternate method on RequestUtils:

    public static ActionForm createActionForm(
            HttpServletRequest request,
            String formName,
            String scope,
            ModuleConfig moduleConfig,
            ActionServlet servlet)

presumably it's not asking too much to know the form's name if you intend to set properties on it, and besides, you need to know it so that you can put it in either request or session someplace where the form tag would find it.

Joe


--
Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com "Imagine if every Thursday your shoes exploded if you tied them the usual way. This happens to us all the time with computers, and nobody thinks of complaining."
-- Jef Raskin


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



Reply via email to