Tutorials to .com

Tutorials to .com » Jsp » Tapestry-hivemind » Tapestry4 refused the injection (Inject) function

Tapestry4 refused the injection (Inject) function

Print View , by: iSee ,Total views: 2 ,Word Count: 1014 ,Date: Thu, 16 Apr 2009 Time: 2:48 AM

Tapestry4.0 in an eye-catching feature is the injection function, the configuration and code to achieve the double object into a variety of functions.
inject,JDK1.5,inject; 1. Configuration file to use inject, it is worth noting that even without the use of JDK1.5, inject also be able to work;
JDK1.5(annotation)。 2. JDK1.5 code to support the use of metadata tagging (annotation).
Function of the individual does not like to inject. Not because I am old, refuses to reform, but did not feel much need to use them.
,page,,。 First of all, page document, use it to increase the complexity of configuration, a bit over-suspicion configuration. page document with the template should only include the definition of dynamic content, such as injection of other types of content on there to do better.
Especially for the spring in support of the injection, and finally the use of inject in the page file configuration, not found directly in the code of the method of Bean.
I realized a Initializer, which provides for the open category page category WebApplicationContext visit, this is not more simple?

Howard Lewis Ship is strongly recommended for all types of inject inside in the class to provide direct access method.

,JDK1.5,JDK。 Second, the meta-data tagging is a feature introduced in JDK1.5 with low incompatible versions of the JDK. Now many applications are running under version 1.4.

,page,。 Finally, page features the use of injection is not conducive to reuse.

I now use the environment to develop JDK1.4.2, Tapestry4.0. After using the following method, page and inject the code did not use all the normal work.

Instead of injection (Inject) code

1. Meta injection
<meta key="page.size" value="15"/>
<inject property="pageSize" type="meta" object="page.size"/>
this.getEngine (). getInfrastructure (). getApplicationPropertySource (). getPropertyValue ( "page.size")

II. Object into
infrastructure types of binding, can such a visit
cycle.getInfrastructure (). get ###()
Such as:
<inject property="assetFactory" object="infrastructure:assetFactory"/>
cycle.getInfrastructure (). getAssetFactory ()

III. Page into
<inject property="detailsPage" type="page" object="Details"/>
this.getRequestCycle (). getPage ( "Details");

IV. Script injection
<inject property="script" type="script" object="Palette.script"/>
/ / Not used the script, so this has not been tested for
Resource s = this.getRequestCycle (). GetInfrastructure (). GetContextRoot (). GetRelativeResource ( "/ Palette / script");
this.getRequestCycle (). getInfrastructure (). getScriptSource (). getScript (s);

5. State injection
<inject name="registration" type="state" object="registration-data"/>
this.getEngine (). getInfrastructure (). getApplicationStateManager (). get ( "registration-data");

Visit and Global objects similar access methods:
this.getEngine (). getInfrastructure (). getApplicationStateManager (). get ( "visit")
this.getEngine (). getInfrastructure (). getApplicationStateManager (). get ( "global")

6. State-flag-depth study of the type that do not.

7. Attribute / parameter access methods
this.getEngine (). getInfrastructure (). getGlobalPropertySource (). getPropertyValue ( "YourPropertyName")

tapestry & hivemind Articles

Can't Find What You're Looking For?

Rating: Not yet rated


No comments posted.