add(new LibraryMapping("mylib",
"com.packtpub.celebrities"));
}
}
You are already familiar with the bind method of this module??”it tells
Tapestry how to instantiate our custom service. The other method,
contributeComponentClassResolver(), serves to tell Tapestry that if any
component on a page is defined using the MyLib prefix (you will see how this is
done soon), it will find this component in the com.packtpub.celebrities package.
Creating Custom Components
[ 236 ]
With all the source files and resources in place, you should have the following
structure of packages in your project:
The final step is to make sure that Tapestry knows how to locate the library module
we have recently created. For this, we need to put the following entry into the
manifest of the JAR file containing our library:
Tapestry-Module-Classes: com.packtpub.celebrities.LibraryModule
The Manifest is a standard part of any JAR file. It is named MANIFEST.MF and placed
in the META-INF directory of the package. Often, we do not care about what this
file contains and it is generated for us automatically. This time, however, we need
to ensure that the path to our library module is added to the manifest. The way
we do this will depend on the IDE, but first of all, let's decide what our manifest
will contain.
Pages:
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294