当前位置:首页 » 软件开发
开发技术指南» 文章正文
    引言: Java is often criticized for i
 

 

 ·a three-way query @ jdj    »显示摘要«
    摘要: lightweight directory access protocol (ldap) is fast becoming a de facto access method for common directory information. xml is now the standard for data exchange on the web. the relational datab......
 ·building a telephone/voice portal @ jdj    »显示摘要«
    摘要: last month we introduced the phonelet architecture and developer api for creating lightweight telephone/voice services in java. this article expands the automated answering machine with caller......


Dynamic Code Generation @ JDJ

java is often criticized for its performance, particularly in comparison to equivalent code written in languages such as c and c++. advances in runtime performance have silenced many critics, but still there are times when no matter how fast java is, its just not fast enough.

fortunately, java does have some unique properties that make a class of optimizations accessible that are not easily applied to other platforms. one technique that can be used to great effect on certain types of tasks is dynamic code generation.

dynamic code generation is the process of generating java classes at runtime that can then be loaded into that same java virtual machine (jvm) and accessed the same way as ordinary compiled java classes. the usefulness of the technique might not be immediately apparent, but its actually used to a great degree of success in several critical, high-profile java technologies.

javaserver pages

perhaps the best-known example of dynamic code generation in java is javaserver pages (jsp). a servlet engine is capable of dispatching requests to a servlet for processing. unfortunately, servlets are static in nature. they typically need to be precompiled and preconfigured in the servlet engine before server startup. although theyre quite useful, web development often requires a more flexible solution.

jsp breaks these restrictions and allows servlets to be dynamically created at runtime based on the contents of a jsp file. when a request is made for a jsp file, the servlet engine makes a request to the jsp engine, which in turn will process the jsp file and send a result. a jsp is a textual representation of a set of actions to be performed to present a page to the user, and interpreting it anew for each request would be quite costly. instead, the jsp engine will compile the jsp and dynamically create a servlet object. if the specification changes, a new servlet will be dynamically generated.

dynamic code generation
...   下一页

 ·evolving functionality @ jdj    »显示摘要«
    摘要: c++ brought into vogue the concept of interfaces, abstractness, and implementations. java went a step further and formalized them with proper keywords for each of the concepts. there are a subst......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE