Re: Anybody? .. Re: Help with a design issue that I'm stumped by....
Vic Cekvenich <[email protected]> Sat, 10 May 2003 18:39:31 -0400
| Newsgroups | gmane.comp.java.mvc.devel |
|---|---|
| Organization | baseBeans Engineering |
| Message-ID | <[email protected]> |
Rick Reumann wrote:
>On Sat, 10 May 2003 17:22:41 -0400, Vic Cekvenich wrote:
>
>
>
>
>><!- - since bean is mapped, Struts does the new for you so any new by
>>you is just GC - - >
>><action path ="/srchPg" type="com.r.SrchAct"
>>name="srcBean" scope="session" validate="false">
>> <forward name="Success" path="srch.jsp" />
>> <forward name="Submit" path="/do/empPg?Dispatch=List" />
>></action>
>>
>><! - - in action you have to do if/then to see if you have enough data
>>to execute the srch, action is the controller, eh - - >
>>
>><action path ="/ empPg" type="com.r.EmpAct"
>>name="empBean" scope="session" validate="false">
>> <forward name="Success" path="empLst.jsp" />
>> <forward name="Edit" path="empEdit.jsp" />
>></action>
>>
>>
>
>
>This is "action chaining"... which is what you said you never did:)
>
Oh.
>Not
>saying it's wrong, it is just that you implied it could be done
>differently. Notice if a forward of "Submit" is returned from the SrchAct
>it ends up directly submitting to the EmpAct. I could most certainly do
>this but then you end up having to pull the 'SearchBean" out of the
>session inside of your EmployeeAction - which, again, is fine - but in
>the original post you claimed you didn't have to do it this way.
>
not sure.
>
>Remember I said :
>
>"The only way I can see to accomplish what you are suggesting is to chain
>the actions (usually people are against this). In other words where does
>the searchBean/searchAction mapping forward to? It would seem like to
>accomplish what you want you'd have to forward it to another action (
>ListOfEmployeesAction ) which in turn would then forward you to an
>eventual page with your list of employees."
>
>And you replied:
>
>"I have never needed action chaining. You are just over anyalizing maybe.
>Struts is MVC so there are 3 parts to everything."
>
OK
>
>
>So back in a circle... you "do" need to chain the actions
>
My bad. I assumed action chaining was calling another action from action.
> - that is one
>action actually submits to another action OR if you do not want to chain
>them, like you did above, then you need to have SrchAct also responsible for
>returning your List backed EmployeeBeans OR instead have a mapping like:
>
><action path ="/getEmployees type="com.r.EmpAct"
>name="srcBean" scope="session" validate="false">
> <forward name="Success" path="list.jsp" />
></action>
>
>
>I'm starting to think that the above action is not such a bad idea.
>
I do not like that as ideal, but I was wrong so far. To me, employe
action should have employee bean for clear MVC maitanance.
>The
>reason being is even if you don't do it like in the above and instead set
>it up where your srchAction forwards to EmpAct, EmpAct is 'still' going to
>have to deal with "SearchBean" (pulling it out of scope and getting the
>parameters). Since that is the case it might be more clear ot just have ac
>action like the above. It doesn't seem like any more work to do:
>
>EmployeeBean bean = new EmployeeBean(); //List Bean
>
>as it does to do
>
>SearchBean bean = (SearchBean).request.getAttribute("searchBean")
>
>
I like 2nd choice
>
>
>
>
.V