Sunday, May 15, 2005

IBM portlet programming interview questions

What is the difference between a servlet and a portlet?
Portlet is basically an extension of servlet but with some fundamental differences like a web page can consist of mulitple portlets but can have only single servlet, portlets cannot do browser redirect but servlet can.

What are the similarities between a servlet and a portlet?
Portlet is a an extension of servlet, can write html output, can forward but within the same portlet context, access to HTTP objects like session, request, response, along with similar Portlet objects like session, request, response.

What is WSRP?
Web Services Remote Portlet.

What are the different approaches for logging in portlet?
Websphere log apis, log4j, custom logging, jdk1.4 log apis and any logging framework should work just as well.

What are the different approaches for managing environment specific configuration?
Properties file, portlet attributes (configured via the config-param in portlet.xml).

Difference between abstract portlet and concrete portlet?

Explain struts portlet. How to create one?
Create a struts standalone web app and convert to portlet. There are 8-10 steps to do so.

Explain JSR168 portlet. How to create one?
Use WSAD wizard.

What is the difference between HTTPRequest and PortletRequest?
HTTPRequest is for the entire portal page and portlet request is abstracted out of HTTPRequest and is unique per portlet. As best practises portlet code should use PortletRequest object.

Should you use class scoped variables in portlet?
No, single instance of portlet in the JVM and so can cause data corruption if variable values are changed. However, no harm in using "final static" singleton kind of variables.

Can you do browser redirects from the portlet?
No, only forward.

What does the tag <portletApi:init /> do?
Initializes portletRequest, portletResponse, etc on the page.

What are the different portlet states?
Maximize, Normak, Minimize.

What are the different portlet modes?
View, Edit, Configure, Help.

Portlets execute in two steps, what are those?
Action and render in portal 5.0. There is a new phase IStrutsPrepareRendor introduced in portal 5.1 to address browser refresh, back, etc issue.

How to access external systems from portlet code like database, credential vault, and ftp server?

What is portal service?

1 comment:

Anonymous said...

whaaaat?