Missing a Business Service figure in T5.1

View: New views
4 Messages — Rating Filter:   Alert me  

Missing a Business Service figure in T5.1

by josete :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Missing a Business Service figure in T5.1

by Robert Zeigler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Why not use action or event links to do this?
If you need the links available from every page, then write yourself a  
component that you drop onto any page (eg: a layout component).  Then  
you can do your heavy processing inside of the event handlers, even  
return the new page to render.

Robert

On Nov 5, 2009, at 11/51:22 PM , josete wrote:

> king 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>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Missing a Business Service figure in T5.1

by josete :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Uhm .. didn't know about event links .. i like it.
Thanks.

> Why not use action or event links to do this?
> If you need the links available from every page, then write yourself a
> component that you drop onto any page (eg: a layout component).  Then
> you can do your heavy processing inside of the event handlers, even
> return the new page to render.
>
> Robert
>
> On Nov 5, 2009, at 11/51:22 PM , josete wrote:
>
>> king 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>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Missing a Business Service figure in T5.1

by Howard Lewis Ship :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Futher, you can crate a zone and have the actionlink/eventlink update
the zone ... but the action handler method can return a page class or
page instance, and Tapestry will redirect to that page.

On Fri, Nov 6, 2009 at 1:51 AM, josete <joseluis.sanchez@...> wrote:

> Uhm .. didn't know about event links .. i like it.
> Thanks.
>
>> Why not use action or event links to do this?
>> If you need the links available from every page, then write yourself a
>> component that you drop onto any page (eg: a layout component).  Then you
>> can do your heavy processing inside of the event handlers, even return the
>> new page to render.
>>
>> Robert
>>
>> On Nov 5, 2009, at 11/51:22 PM , josete wrote:
>>
>>> king 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>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@...
>> For additional commands, e-mail: users-help@...
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>



--
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

(971) 678-5210
http://howardlewisship.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...