On Tue, 27 May 2003 09:57:33 -0400, Vic Cekvenich wrote:
 
> Struts does this for you. On a submit, all the bean properties are set 
> by Struts before the action gets executed. There is not new bean, since 
> it's in scope already. 

Yes, normally it does. But remember all of this is complicated by this
"search" that I'm talking about. Remember I'm trying to get a list backed
bean based on certain search criteria (WHERE parameters). The idea you
helped me come up with was this pattern....

(For this example using "ProjectBean" and "ProjectSearchBean"...)

/projectSearch backed by ProjectSearchBean forwards the user to a a JSP
Form where they select paramaters that they want to get a list of Projects
back for.

Submitting above form ends up forwarding to the ProjectAdminAction with
Dispatch "Display"

In the onDisplayExec method of ProjectAdminAction I then have to pull the
ProjectSearchBean out of session scope and then can pull out the search
params..

ProjectSearchBean searchBean =
(ProjectSearchBean)ae.getSessionBean("projectSearchBean");
ArrayList projectIds = projectSearchBean.getProjectIds();
String someOtherVar = projectSearchBean.getSomeOtherVar();

//now populate based on search params above
projectFormBean.populate( projectIds, someOtherVar );

The above seems to be what you mentioned is the best way to handle this
type of search feature. What is happening here is much different than the
typical save, update type of procedure that you can call ProjectBean. I
understand how that's all done. This is much different since the above
properties are necessarily part of ProjectBean, they are simply properties
used to create the WHERE portion for bring back the ProjectBean list. 

At some point later I end up putting the above variables projectIds and
someOtherVar into a HashMap in the ProjectBeanDAO so I can pass that to
IBatis. It works fine but it just seems a bit cumbrsome to pull all the
values out of the ProjectSearchBean and then put them back into some
storage object (in this case HashMap). 

Since ProjectSearchBean is a BaseBean, should I maybe just call:
projectFormBean.populate( searchBean.getMap() ) 
?

It just seems weird to take everything out of the BaseBean in order to
call populate( var, var, var), only to rebuild it all again into an object
in the DAO so that I can call 
doRetrieve("ProjectSelect", (Object)map );

 
> 
> It says in iBatis DOCs how iBatis processes a "custom" SQL parm. You can 
> need to create the SQL ending dynamically. It's done a lot on search 
> screens, dynamic WHERE.

Thanks...found it. Awesome.

-- 
Rick

_______________________________________________
MVC-Programmers mailing list
[EMAIL PROTECTED]
http://www.basebeans.net:8080/mailman/listinfo/mvc-programmers

Reply via email to