Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PortletModes: doEdit doView doHelp doPrint doConfigure: 168

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,206
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jul 14, 2008

http://www.scja.com/jsr168/index.jsp?link=multi11modes

Check out my actual website for the full screen, high resolution video:

http://www.scja.com/jsr168/index.jsp?link=multi11modes

Standard JSR 168 Portlet Modes

Any preliminary look at the portlet API will demonstrate a major similarity between portlets and servlets. Both portlets and servlets handle the request-response cycle, both are Java centric components, and both have access to the J2EE runtime environment. But there are some major differences between portlets and servlets as well.

One of the most significant ways portlets are different from regular servlets is their support for various modes, namely view, edit and help. When it comes to portlet modes, there is no applicable analogy to typical servlet and JSP programming. This tutorial will look at the various modes available to the portlets you create, and how a developer can programmatically take advantage of these modes.
Breaking Away from a Portlet as a Servlet Mentality

Handling a request-response cycle is the most fundamental aspect of portlet programming, but inspecting a request and sending out a response to the client through a portlet is by no means revolutionary. After all, request-response programming is exactly what we do in a Java servlet.

Let?s compare a Portlet to a Servlet: instead of a doView method, a Java Servlet has a doPost or a doGet method. Instead of being passed a PortletRequest or a PortletResponse object, a Java servlet is given an HttpServletRequest and HttpServletResponse object. In many ways, handling the request-response cycle of a portlet is very similar to handling the request-response cycle of a Servlet. In fact, one of the great things about portlets is the fact that they leverage our existing knowledge of the Servlet and JSP APIs.

But what makes a portlet so incredibly sexy is all of the features and services the Portlet API affords us, over and above that of the Servlet API. The most fundamental difference between a Portlet and a Servlet is the various modes in which a Portlet can participate.

A portlet has three standard, and any number of custom, implementable modes, namely: * The View Mode * The Edit Mode * The Help Mode

The most common, and only required mode of a Portlet, is the view mode. When a Portlet is displayed on a page, it is typically displaying its view mode. In fact, the specification requires every portlet to have a doView method so that the portlet can render itself on a portal page.

Optionally, a portlet can provide an implementation of any of the other standard modes, with perhaps the most useful mode being edit, and the most helpful, being help. :)

Please support our site, link to us, buy some books, and remember: Happy Java!

If you get a chance, pick up my Portlet Development Book on amazon.com And check out my Hibernate & JPA development book, WebSphere book, and SCJA Sun Java Certification Guide as well!

http://www.scja.com/associate
http://www.thebookonhibernate.com

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (0)

Sign In or Sign Up now to post a comment!
Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more