Hi all.

I'm facing some 'teorical' problem, i still haven't found a solution to.

Let me explain :
I have a page, with a list of pagelinks.

Clicking on a page link makes the application do lot of business logic, and then, sends the user to the end page.

The business logic is done inside in a non-viewable ( has no .tml ) page, inside its onActivate method .. who then return the resulting page.

The flow is like this :

list.tml -> doTheLogic.java:onActivate -> result.tml / error.tml

I don't feel comfortable doing it like this .. but if any of you think there's a better solution, please let me know. As you can see, i am using a page as a 'business service' class .. because i found no way to cook it ..

BTW: inside the doTheLogic.java i have a hibernate session injected, and two T5 pages injected ( to be returned )

Thanks all.



---- some code ---

list.tml

<t:pagelink page="doSomeLogic" context="${thePlan.id}"><img src="${buybutton}"/></t:pagelink>


doSomeLogic.Java

    @Inject
    Session session;
    @InjectPage
    ErrorPage errorPage;
    @InjectPage
    ResultPage resultPage;

    Object onActivate(Long aPlanId)  {

            if ( condition1) {
                heavy database stuff with the session
                lots of logic
                return resultPage
            } else {
                heavy database stuff with the session
                lots of logic
                return errorPage
              }
        }


result.tml/error.tml


<whatever>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to