With the need for organizations to manage applications securely across the enterprise, along with the additional challenge of centralizing the management of a plethora of applications that must be customized and personalized depending upon the department or location in which a user works and lives, enterprise portals are playing a more and more important role when it comes to aggregated software delivery. In the Java ecosystem, this means software engineers are now creating portlet based applications instead of the more traditional servlet based ones. And given the popularity of using portlet applications as a mechanism for software delivery, more and more enterprise Java developers are being asked to learn the Portal API, and acquire portlet development skills.
Fortunately for Java EE developers who are learning the intricacies of the portal, there are many similarities between the JSR 286 API (Portlet 2.0) and the Servlet and JSP specification. Understanding these similarities and differences are the key to learning portlet development and transitioning seamlessly from developing servlets and JSPs.
Similarities between portlets and servlets
Here are a few similarities between portlets and servlets that will make traditional enterprise Java developers feel much more at ease with the technology:
- Both portlets and servlets are Java based technologies for developing web components
- Both portlets and servlets are managed by a container which bridges the code written by the developer to the various services that are provided by the application server at runtime
- Both portlets and servlets leverage standard Java APIs like JDBC, JMS and JNDI to access resources and generate dynamic content for the user
- Both portlet and servlet applications are packaged in web application archives, also known as WAR files, when they ready for deployment
- Both portlet and servlet applications are mechanisms for supporting the request-response cycle that is common to all web based technologies
Differences between portlets and servlets
But of course, no discussion of similarities is complete without highlighting some of the key differences between portlet based applications and applications developed using servlets and JSPs:
- Unlike servlets, portlets do not render an entire HTML page to the client, but instead are only responsible for a fragment of the web page that gets returned
- Portlets cannot be addressed directly like a servlet, JSP or even HTML file. In order for a portlet to link back to itself, the JSR 286 API needs to be called on to perform the required slight of hand.
- Portlets have a more elaborate request and response handling system made up of an action processing phase for data manipulation and a separate phase for rendering content to the end user.
- Portlets have the ability to react to maximized, minimized and regular modes, a concept that is foreign to servlet developers. Portlets also have modes like view, edit, config, about and print.
- Portlets have advanced features that help to simplify the AJAX based request-response cycle.
- The PortletSession has two different scopes for storing data, whereas the servlet API only has one.
- The JSR 286 API provides an advanced set of components for sending events back and forth between portlets. Again, this is a foreign concept to servlet and JSP developers.
Learning any new API can be intimidating, especially when it is one that requires an entire shift away from a form of application development that an individual has been practicing for over a decade. But when it comes to learning JSR 286, seasoned software developers don't need to fret, because there are a significant number of similarities between traditional servlet development and the type of development that is done when targeting a portal server. And of course, while there are differences, many software engineers find that the difference, such as the way the portal API handles AJAX based requests, actually makes development easier, not harder.
The resurgence of the portal server
Portal servers are experiencing renewed interest from large organizations who are recognizing the benefits of the technology when it comes to managing software applications across a global enterprise. And with this renewed interest, the demand for developers who are experienced with portlet development is growing. Any software engineer that can harness the similarities and exploit the differences between JSR 286 and the Java based web component development they have been used to are going to find an increasing demand for their skills, and an increase in remuneration for the development work they perform.
Do you have any quick tips for learning the JSR 286 portlet API?Let us knowhow you pick up new APIs.