|
Service
Writing a simple Service for your Tapestry Application.
for more about Tapestry Service go http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html Tapestry ServicesServices consist of two main parts: a service interface and a service implementation. The service interface is how the service will be represented throughout the rest of the application. Service Interface and ImplementationCreate an Interface (Service.java) in services package. declare service methods in interface. Create a Class (ServiceImpl.java) in services package. this class most implement 'Service' Interface. Add Service To Your ApplicationEach Tapestry Application could have special class that called Module class. A module class exists for the following reasons:
Module Class name consist of two parts : <tapestry filter name> + Module. This class most be in services package. for example if your application filter name is myapp your module class name most be MyAppModule.java or MyappModule.java(the filter name is case insensitive). note that application filter name was defined in web.xml. put this code in your AppModule class :
Inject Service to Pageput this code in your page class :
after this you can use service and call its methods in your page for more about Tapestry Service go http://tapestry.apache.org/tapestry5/tapestry-ioc/service.html good luck. |
Sign in to add a comment
