Friday, April 3, 2015

Custom JSP/JSF Tags With Dynamic Invocation (Reflection)

Team. We have posted some ideas on this before. In the future, the CABOOSE features will probably provide a general-purpose "custom" JSP/JSF tag. This almost sounds oxymoronic, a contradiction or clash of terms. How can something serve a general purpose and be customized at the same time?

Basically, we will create a "special-purpose" or "custom" tag which can invoke a method from any class which it is given. We will likely use programming-by-contract again and ensure that the method which the tag invokes accepts a string array as its only parameter (like the main method of a JAVA Standard Edition program).

It will likely take the following form:

<caboose:pin
       class="mypackage.MyClass"
       method="myMethod"
      arguments="paramA,paramB,pramC" />

And, its method will return an HTML or XHTML string which replaces the tag.

As noted in the earlier documents on reflection, CABOOSE experiences a computational "cost" for its dynamic invocation. If these dynamic method calls were "hard-coded" in the source, certain optimizations could occur that would speed processing. Therefore, using CABOOSE requires slightly more computing cycles for accomplishing what one would if he "rolled his own" controller or custom tag each time. This is the trade-off for increased software reuse, reduced project cycle times, concurrent processing of developed task, and a reduced need for as much JAVA Enterprise Edition "know-how" on development teams among other benefits. 

If you are interested in learning more about creating custom JSP/JSF tags, view:

http://www.tutorialspoint.com/jsp/jsp_custom_tags.htm

or

http://docs.oracle.com/cd/E11035_01/wls100/taglib/quickstart.html

This is a little more challenging:

http://docs.oracle.com/javaee/5/tutorial/doc/bnalk.html

Also, Murch provides an excellent text on JSP and Servlet Basics:

http://www.amazon.com/s/ref=nb_sb_noss_1/190-0002710-2917803?url=search-alias%3Daps&field-keywords=Murach+Servlets

For our newest viewers:

Милости Просим. Мы рады, что Вы находитесь здесь

That should say : Welcome. We are glad that your are here!

We hope that these thoughts have sparked some ideas for your own development efforts...Hunt.Peck.Think...Have a Great Weekend.

No comments:

Post a Comment