Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Building a Java servlet framework using reflection, Part 1

Reflective code provides more functionality in fewer lines of code.

  • Print
  • Feedback

Page 4 of 4

As new features are added to the system, there is nothing hardcoded that needs to be kept in sync with the code base. The servlet will pick up any additional business logic upon its next execution due to the dynamic class loading that I have demonstrated.

A common error-handling framework is essential to servlet development because it ensures that a user's experience on a Web site is consistent and common to all functionality contained on the site. A single error-handling component is also a benefit to developers because it allows them to avoid building error-handling into every object.

This framework, while simple, does suffer from some overhead due to the isolation of the components, but this also ensures that there are no cross dependencies. The second part of this series will further demonstrate the utility of this framework by expanding on the use of reflective code to enable server-side validation, error handling, data access, and output.

About the author

Michael Cymerman is a consultant specializing in Java/Internet software solutions. Michael provides Java/Internet-based architecture, design, and development solutions to Fortune 500 companies.

Read more about Enterprise Java in JavaWorld's Enterprise Java section.

  • Print
  • Feedback

Resources