WebSphere Portal expert Stefan Hepper answers your questions on portal programming, JSR 168 portlet specification, and Java™ portlet development: why things are the way they are today, how to solve a specific problem, why feature XYZ is missing, or more general architectural and strategic questions. WebSphere Portal is the leading portal product in the market and offers a single point of personalized interaction with applications, content, processes, and people. A portlet is a Java-based Web component that generates dynamic content that you can plug into portals. For more information about WebSphere Portal, see the WebSphere Portal zone.
Question: What is the recommended way to access the HttpSession from within the portlet? We want to store information about the given user in the session and make it available for all portlets, so we want to use the HttpSession.
Answer: The portlet session is a facade on top of the HttpSession. Everything that you put into the portlet session in the application scope will be visible for all portlets and servlets in this portlet application. Use the PortletSession with APPLICATION_SCOPE.
Question: Any examples of IBM surfacing .Net applications through WebSphere Portal?
http://wps51.dfw.ibm.com/, you can log into a demo WebSphere Portal. After registering,
you can see a .Net portlet displayed via Web Services for Remote Portlets (WSRP) in WebSphere Portal under the My Work Developer's Area\WSRP page.
Question: Which is the best way to create Portal usage statistics? How can we get information of the items selected within a portlet, for instance, a link to a document in a backend Notes server?
Answer: Your can use whatever tool you are currently using for Web site analysis. WebSphere Portal produces a sa.log file compatible with the NCSA Combined log format that Web site analysis tools can read and evaluate. See Configuring WebSphere Portal for site analysis logging and Understanding the site analysis log).
Question: How do I suppress the min and max buttons in the JSR 168 portlets?
Answer: You cannot do this in the portlet because these buttons are provided by the portal. Thus, your portal needs to not render these buttons for a specific portlet. In WebSphere Portal, you can do this by creating a special skin.
Question: To develop an Internet banking application using JSR 168 portlet, which include leading J2EE, EJB framework like Spring, Struts, etc, is deploying it in WebSphere Portal a good solution? A quarter million users will access this site, how about WebSphere Portal performance? What kind of application do you suggest to develop and deploy in WebSphere Portal? As per my knowledge, if a customer wants to develop a Content Delivery System, which includes third party integration and collaboration, then WebSphere Portal is the best. But, what about the transaction management system, B2B application, etc? Is WebSphere Portal suitable for this?
Answer: WebSphere Portal runs on the WebSphere platform and you can leverage all J2EE features of WebSphere, including transaction management. Yes, WebSphere Portal is well suited for enterprise applications, and we have customers running WebSphere Portal with several million users. Many of our customers use frameworks like Spring, Struts, or JSF together with WebSphere Portal.
Question: I am looking at several applications, which are somewhat independent, but come together in that they will all use a Web portal for presentation. They will all require various input forms to be filled out by users. What is the best architecture for this? Should I have a different portlet for each form, or is there a "table-driven" way to do this? I keep thinking that in the spirit of a service-oriented architecture, you should be able to create a "forms service" that does the job.
Answer: Your can use Workplace Forms Designer to create these forms in a WYSIWYG manner and export them as portlets.
Question:: I am trying to put some access restrictions to WebSphere Portal users, that is, to allow them to mistype their password only a few times, and then to block their access for a period of time. Is there a setting or solution for this? Or, a place where I can specifically read about this? I tried to find recommendations or workarounds for this problem on IBM and WebSphere sites, but with no success.
Answer: There is no out-of-the-box solution for this currently, but you can write to your LDAP directory directly from the portlet since WebSphere Portal V 188.8.131.52 comes with the com.ibm.portal.um user management package.
Question: Our Java classes in our WAR need to reference some classes outside of the WAR. What is the supported way to do it on WebSphere Portal 5.1?
You can put the jar file in the
PortalServer/shared/app directory to make them accessible to all portlet applications.
How do you access the attributes of the logged-in User as a scripting variable in Theme JSP files?
I have a customized Theme. In Banner.jsp of my customized Theme, I am trying to access the attributes of the logged-in user from an user object, so that I can access the user attributes as string objects within my scriptlets. The
<wps:user attribute=""/> tag can be accessed within
<wps:if loggedIn="yes"> to display the user attributes. But unfortunately, the
<wps:user> tag does not return any scripting variable for writing some custom code in scriptlets. I have also tried instantiating the user object by writing the following code in Banner.jsp:
<%@ taglib uri="/WEB-INF/tld/portlet.tld" prefix="portletAPI" %> <portletAPI:init /> User user = portletRequest.getUser();
But, the portlet API cannot be initialized at the portal level. The above code gives certain exceptions. I need to implement the following logic: If the nickname of the user is present, then show the nickname, else show the fullName of the user.
Answer: Since WebSphere Portal 184.108.40.206, you can access the user management system from portlets or themes and skins. Note that portlet tag libs or APIs are never supposed to work in themes and skins. You can do the following in your theme:
Context ctx = new InitialContext(); com.ibm.portal.um.PumaHome home = (PumaHome) ctx.lookup(portal:service/usermanagement/Puma); // note: you need to do the lookup only once PumaProfile profile = home.getProfile(request); // note: you need to get the profile for each request again Map userattributes = profile.getAttributes(profile.getCurrentUser(), listOfAttributes) ; if ( userattributes.containsKey(nickname) )
Question: I need to display the invalid login error message on both the Login Portlet and the Login screen. I need to enable the display of an appropriate error message when the user enters an invalid user-id or password, on both the default Login Portlet and the default Login screen. Currently, I am able to show the error message on either the Login Portlet or the Login screen. But, I need to enable this error message display functionality on both. I have tried changing the value of authentication.screen.login property in AuthenticationService.properties file, but that didn't solve the problem. Your advice?
Answer: You should only use either one. The preferred one would be the login portlet.
Question: We need to customize the Login portlet and the Selfcare portlets by adding some more fields. Should we opt for the screen option or the portlet option? What factors should govern this decision? We have tried modifying the Selfcare portlet JSPs to suit our needs and they seem to be working fine, but is this the right approach? Or, should we switch over to the screen option only?
Answer: Using a portlet is the more flexible approach. The screens are still supported mainly because of legacy reasons.
Question: We have a portal application that is heavily dependent on the Portal Messaging feature to exchange data between portlets. We need to make this application available to non-WebSphere customers also. But, JSR 168 doesn't seem to have any support for inter-portlet messaging. Is there a timeframe when JSR 168 will support messaging? What alternative approach can we take?
Answer: The only standard way to exchange data is either via the portlet session applications scope for portlets within one portlet application, or via an EJB across applications. Inter-portlet communication will be addressed in version 2.0 of the Portlet Specification, which was submitted to the JCP as JSR 286.
Question: We have a requirement to display a portlet in a popup window in solo mode. The portlet to be displayed in the popup window is on a page that has two other portlets. How to get the objectID or uniquename of the control that has this portlet so that we can use it in the urlGeneration tag?
Answer: Currently, the only way to assign a unique name to a portlet is via XMLAccess. We will provide this capability via the UI in one of the next WebSphere Portal releases. For now, you need to do the following in the XMLAccess script:
<request ...> <portal action="locate"> ... <content-node content-parentref="Content.Root.My_Portal" action="update" active="true" objectid="my.page.1" uniquename="my.unique.name.page" type="page" skinref="undefined"> ... <component action="update" ordinal="100" type="control" uniquename="my.unique.name.portlet"> <portletinstance action="update" objectid="my.page.1.portlet1" portletref="ExtReg"/> </component> ... </content-node> </portal> </request>:
If you only need to have a popup window, you can also achieve this with the following:
<portal:urlGeneration contentNode="my.unique.name.page" layoutNode="my.unique.name.portlet" portletWindowState="maximized" newWindow="true"> <a href="<% wpsURL.write(out); %>">MyPortletInNewWindow</a> </portal:urlGeneration>
Solo mode support is currently not that easy to use for JSR 168 portlets because these portlets need to create the return URL by themselves, using the com.ibm.portal.state API.
- Learn about the programming model from the architects' point of view in Introducing the WebSphere Portal 220.127.116.11 programming model.
- Learn about creating a JSR 168-compliant portlet that can be consumed by multiple portals using Web Services for Remote Portlets (WSRP) in Creating a JSR 168 portlet for use by diverse portals using Web Services for Remote Portlets.
- Learn about best practices for designing and developing portlets that conform to the JSR-168 standard in Best practices: Developing portlets using JSR 168 and WebSphere Portal V5.02.
- Learn how you can cache data in JSR 168 portlets to avoid unnecessary backend requests in Caching data in JSR 168 portlets with WebSphere Portal V5.1.
- Learn what it takes to start a new project to implement a portal using WebSphere Portal in Creating a new portal, Part 1: Getting started.
- Find find information about planning, installing, configuring, administering, developing, and troubleshooting WebSphere Portal at WebSphere Portal V5.1.x Information Center.
- Visit the developerWorks WebSphere Portal zone for technical and how-to information.
- Participate in the WebSphere Portal forum.