> Consider this alternative. Note that this is fleshed out a bit more than
the
> original maverick.xml I started with

Would it be good idea to define controllers outside of commands?
This would allow us to reuse controller definitions in different commands.
Just like views can be defined outside and referenced using <view ref=""/>

    <controller id="Bootstrap" class="com.foo.Bootstrap"
proceedOn="continue">
        <view name="error" path="fatalErrorPage.jsp"/>
    </controller>

    <controller id="Authenticate" class="com.foo.Authenticate"
proceedOn="continue">
        <view name="displayLogin" path="login.jsp"/>
        <view name="notAuthorized" path="notAuthorized.jsp"/>
    </controller>

    <command name="myCommand1">
        <controller-pipeline>
            <controller ref="Bootstrap"/>
            <controller ref="Authenticate"/>
            <controller class="com.foo.Command1"/>
        </controller-pipeline>
        <view name="success" path="myPage.jsp"/>
        <view name="error" path="errorPage.jsp"/>
    </command>

and another command that need a bit different bootstrap behaviour:

    <command name="myCommand2">
        <controller-pipeline>
            <controller id="Bootstrap" class="com.foo.Bootstrap"
proceedOn="continue">
                <view name="error" path="someOtherFatalErrorPage.jsp"/>
            </controller>
            <controller ref="Authenticate"/>
            <controller class="com.foo.Command1"/>
        </controller-pipeline>
        <view name="success" path="myPage.jsp"/>
        <view name="error" path="errorPage.jsp"/>
    </command>

Does it make sense?

with best wishes,
Taavi



> <command name="myCommand1">
>   <controller-pipeline>
>
>      <controller class="com.foo.Bootstrap" proceedOn="continue">
> <view name="error" path="fatalErrorPage.jsp"/>
>      </controller>
>
>      <controller class="com.foo.Authenticate" proceedOn="continue">
>        <view name="displayLogin" path="login.jsp"/>
> <view name="notAuthorized" path="notAuthorized.jsp"/>
>      </controller>
>
>      <controller class="com.foo.ModuleSpecific1" proceedOn="continue"/>
>      <controller class="com.foo.Command1"/>
>    </controller-pipeline>
>
>    <view name="success" path="myPage.jsp"/>
>    <view name="error" path="errorPage.jsp"/>
> </command>
>
>
>
> This approach gives us nearly as simple and readable as the former, but it
> supports simple flow control the previous example fatally lacked. If go()
> returns the value of the proceedOn attribute we execute the next
controller,
> otherwise it renders a view listed within the <controller> tag or outside
of
> the <controller-pipeline> tag.



-------------------------------------------------------
This SF.net email is sponsored by: Scholarships for Techies!
Can't afford IT training? All 2003 ictp students receive scholarships.
Get hands-on training in Microsoft, Cisco, Sun, Linux/UNIX, and more.
www.ictp.com/training/sourceforge.asp
[INVALID FOOTER]

Reply via email to