Pros and cons of Java portlets?

I have a project in which my client asks me to use the spec 1.0 portlets and Websphere Portal Server 6.0. I have not worked with portlets before, but what I heard about them has always been bad criticism. What are the reasons besides their obvious use? If there is no reason, what arguments can I use to avoid them?

+6
java portlet evaluation
source share
3 answers

The problems that I have with portlets remind me of the same problems that EJBs-

  • portlets require that you write special code that can only be hosted and run on a special server;
  • each portlet server provider has user extensions / configurations / additional features, so there is no need to change server providers;
  • portlets seem overly complex to cover functionality that 90% of people who want to use it don't need.

I would suggest something like Google Gadgets as hibernation for the EJB portlet -

  • Javascript framework - server-side parts can be written in any language hosted on any server.
  • easier to use
  • many portal servers support it, and it is more portable across the entire vendor, because it is not so complicated, and this is not a specification for sellers to implement (and extend)
+5
source share

As someone who has had several tasks (including my current one) developing Java portlets, I would say do not use them.

Here's the problem:

If you just wanted to use the pre-existing features of the portal that you select, use the portal.

If you use portlets just to create a small, lightweight, mostly read-only web panel where you can quickly view scattered information, then that's fine.

But if you (or most likely someone above in the org diagram) think of portlets as how to bring a lot of different web applications to the page, and all of this “just works”, then you are headed for the world of pain. Portlets are very limited, autonomous islands of functionality, not web applications in tiny squares per page.

Each of my portlet-based assignments made this mistake, and there is no light at the end of the tunnel. As a portlet developer, here is a short list of things you’re used to doing in regular web applications that you cannot reliably perform in portlets:

  • Create URLs to other pages. To do this, you will need a vendor-specific method, because the portlet API allows you to create URLs for the portlet generated by them.
  • Read and set the HTTP headers or set the HTTP response code (so do not redirect or cache HTTP, since you do not own the page on which the portlet will be placed)
  • The presence of a namespace for all identifiers on the generated page. This means HTML identifier attributes and JavaScript function names. Since the namespace must be defined at runtime to ensure uniqueness, you cannot have these Javascript functions in a separate file accessible by the browser, which should be in the response body for your portlet.

Portlets feel as if they were intended for the state of web development, as they were in the mid-late 90s (pre-AJAX). But they are not suitable for modern web development environments (AJAX, single-page web applications, etc.), which assume that you have complete control over the request / response cycle.

+9
source share

Portlets are attractive to business because of the promise of flexibility, you allow customers to customize and rearrange the components on the page, and if you mainly serve content, they are an effective tool for this.

In my opinion, portals are well suited for combining portlets that are either pure content, functionally independent or simply connected (for example, when you select an item from a list in one portlet, you update another to show details). Portlets can also include reuse, because you can easily customize them to multiple pages / locations.

In cases where problems can begin, you try to decompose complex business functions with a few steps and interactions. In this scenario, defining the granularity of portlets is more of an art than a science, and the interactions between portlets need to be carefully studied.

You also need to consider the flexibility of the user interface. If you have a set of portlet building blocks, your business should be clear so that they can change these blocks, but moving elements between portlets involves rewriting. For example, moving the submit button from one portlet to the bottom of the page is not trivial.

So, I think it depends on what you are trying to do and how much reuse you expect from the components. It may be easier to manage reuse by creating technical components that are IT embedded in servlets, or maybe portlets are perfect for your business. There is no right answer, you just need to carefully consider what you are trying to achieve. If you decide to use portlets, you need to cover the full life cycle and avoid the temptation to get around them, you can quickly find yourself in a bad place with all the overhead and limitations of portlets, without being able to realize the benefits.

+3
source share

All Articles