ok

Martin Cooper wrote:
> I think you missed the point of my message, Vic. I understand what you're
> saying, but the interchange, as I read it, went something like this:
> 
> Q: How can I use DynaActionForm in my action classes?
> A: You should use this other framework over here...
> 
> In other words, the answer really didn't fit the question, however useful
> the techniques you mentioned might be.
> 
> In the words of our very own Eddie Bush ;-), it's a good idea to "KISS [the]
> answers", rather than answer a relatively simple question with a suggestion
> to use a new and different design approach.
> 
> --
> Martin Cooper
> 
> 
> 
>>-----Original Message-----
>>From: V. Cekvenich [mailto:[EMAIL PROTECTED]]
>>Sent: Monday, September 30, 2002 9:32 PM
>>To: [EMAIL PROTECTED]
>>Subject: Re: okay, one more time for the slow people...
>>
>>
>>It think it not a bad idea to make ones web app be able to be 
>>ported to 
>>JSF for example, especially if you are starting development 
>>today. Your 
>>beans for example should be able to work on JSF, perhaps even w/o 
>>Struts, and even some action portability would be in order.
>>
>>My action implements and interfaces, as do the beans and the 
>>DAO. I call 
>>everything by the interface, so it looks a bit strange.
>>Today, the bassicPortal sample apps (CMS, task tracking) is 
>>implemented 
>>with Struts. But if I was careful enough to always call the 
>>interface, I 
>>could use it in JSF, or other MVC, if JFC falls short.
>>
>>I think interfaces is as KISS as you can to make it cross over 
>>frameworks. (How I wish that formbean was an interface, you 
>>have heard 
>>me say Martin. I see MVC as one big interface)
>>
>>All I do here is "get a handle on the form bean and then populate it 
>>with a find, and then forward".
>>I could say above. or this:
>>public Object onDisplayZoomExec(ActionEvent ae) throws Exception
>>{
>>String id = ae.getReq().getParameter(ID); // the PK is?
>>long ia = BUtil.longString(id);
>>              
>>TasksBean frm  = (TasksBean) ((TilesEvent)ae).getFormBean();
>>              
>>setBBean( frm );
>>getBBean().findSingle(ia); // hard code for now
>>              
>>ae.getReq().setAttribute(FORMBEAN, getBBean());
>>
>>return ((TilesEvent)ae).getMapping().findForward("Zoom");
>>}
>>
>>But I am willing to learn a better practical design of anything.
>>. Besides interface it also uses tiles action and not action. 
>>(basicPortal has all the interfaces and implementation)
>>
>>Some posters on mail list only do philosophical answers, but 
>>if I show 
>>code, I can live with the critiqe, it makes it a better design.
>>
>>Above is a very good design and a good code sample
>>
>>
>>V.
>>Struts Mentor
>>baseBeans.com
>>
>>
>>
>>
>>
>>Martin Cooper wrote:
>>
>>>It seems to me that this code is already *relying* on 
>>
>>another framework in
>>
>>>order to be "more portable to another MVC framework". ActionEvent,
>>>TilesEvent, TaskBean, BUtil, etc. are not Struts classes. 
>>
>>Pulling in another
>>
>>>framework just to be able to use DynaActionForm seems like 
>>
>>the antithesis of
>>
>>>KISS for the particular question posed...
>>>
>>>--
>>>Martin Cooper
>>>
>>>
>>>
>>>
>>>>-----Original Message-----
>>>>From: V. Cekvenich [mailto:[EMAIL PROTECTED]]
>>>>Sent: Monday, September 30, 2002 5:17 PM
>>>>To: [EMAIL PROTECTED]
>>>>Subject: Re: okay, one more time for the slow people...
>>>>
>>>>
>>>>The other way is:
>>>>public Object onDisplayZoomExec(ActionEvent ae) throws Exception
>>>>{
>>>>String id = ae.getReq().getParameter(ID); // the PK is?
>>>>long ia = BUtil.longString(id);
>>>>            
>>>>TasksBean frm  = (TasksBean) ((TilesEvent)ae).getFormBean();
>>>>            
>>>>setBBean( frm );
>>>>getBBean().findSingle(ia); // hard code for now
>>>>            
>>>>ae.getReq().setAttribute(FORMBEAN, getBBean());
>>>>
>>>>return ((TilesEvent)ae).getMapping().findForward("Zoom");
>>>>}
>>>>
>>>>
>>>>KISS, the code does not need UML or even comments or design.
>>>>Keep it simple, complex != good or fast
>>>>This code is also more portable to another MVC framework, ex. 
>>>>JSF (one 
>>>>reason is that controlers is an interface, in this exmple 
>>>
>>at the tile 
>>
>>>>level, so each tile has it's own events)
>>>>Note use of event object, and auto dispatching of events. This gets 
>>>>consumed by the JSTL tags. Also the bean, which you can't see 
>>>>here calls 
>>>>DAO .retrieve() in its findX ().
>>>>(code from the Struts basicPortal on sf.net)
>>>>
>>>>.V
>>>>(Struts mentor 
>>>>http://www.mail-archive.com/mvc-programmers%40basebeans.com/ms
>>>
>>>g00242.html
>>>
>>>
>>>>)
>>>>
>>>>
>>>>
>>>>Eddie Bush wrote:
>>>>
>>>>
>>>>>- Declare your form to be of type DynaActionForm in struts-config
>>>>>- Declare your properties to be of whatever type they need to be
>>>>>- Preface the page call with an action which will cast the "form" 
>>>>>argument to be a DynaActionForm
>>>>>- call form.set("property", value) as needed
>>>>>- forward to the page that will use the form
>>>>>
>>>>>Chapter 5 pg 20 of Chuck's book covers this quite well. 
>>>>
>>>>(That may not be 
>>>>
>>>>
>>>>>exact, but it's close)
>>>>>
>>>>>I'm not going to claim it's "the official way" - but it's 
>>>>
>>>>often done 
>>>>
>>>>
>>>>>this way, for sure.  Follow Chuck's example.  Remember that 
>>>>
>>>>(unless you 
>>>>
>>>>
>>>>>have extenuating circumstances - most of the time 
>>>>
>>>>pre-population does 
>>>>
>>>>
>>>>>not qualify) you should never have to create a form 
>>>>
>>>>yourself.  Expect it 
>>>>
>>>>
>>>>>to be there.  If it's not, double-check your config to 
>>>>
>>>>ensure you told 
>>>>
>>>>
>>>>>Struts to make sure it was there.  If you have done that 
>>>>
>>>>and it didn't 
>>>>
>>>>
>>>>>let it NPE and then file a bug report.
>>>>>
>>>>>Vincent Stoessel wrote:
>>>>>
>>>>>
>>>>>
>>>>>>How do you use the DyanActionForm in the action classes.
>>>>>>I saw 2 different examples in the archive, neither of 
>>>>>
>>>>which worked for
>>>>
>>>>
>>>>>>me.
>>>>>>
>>>>>>   DynaActionFormClass dafc = 
>>>>>>DynaActionFormClass.getDynaActionFormClass("AddUserForm");
>>>>>>   DynaActionForm myForm = dafc.newInstance();
>>>>>>
>>>>>>
>>>>>>gives me this compile error:
>>>>>>
>>>>>>AddUserAction.java [48:1] incompatible types
>>>>>>found   : org.apache.commons.beanutils.DynaBean
>>>>>>required: org.apache.struts.action.DynaActionForm
>>>>>>
>>>>>>line 48 : DynaActionForm myForm = dafc.newInstance();
>>>>>>
>>>>>>
>>>>>>What is the official way?
>>>>>>Thanks.
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>--
>>>>To unsubscribe, e-mail:   
>>>><mailto:[EMAIL PROTECTED]>
>>>>For additional commands, e-mail: 
>>>><mailto:[EMAIL PROTECTED]>
>>>>
>>>>
>>
>>
>>
>>--
>>To unsubscribe, e-mail:   
>><mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: 
>><mailto:[EMAIL PROTECTED]>
>>
>>




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

Reply via email to