School dropout
becomes MILLIONAIRE!
Read his NLP methods.

Monday, March 5, 2007

Task 2 bug fix

Bug
  • My developed portlets refresh and somehow loses their sense of identity, rendering content of another portlet's.
Here's an example of what my portlet class is like:

public class BBPortlet extends StrutsPortlet {

public static final String DEFAULT_VIEW_ACTION = "/ext/bb/view";

public void init(PortletConfig config) throws PortletException {
super.init(config);

if (Validator.isNull(viewAction)) {
viewAction = DEFAULT_VIEW_ACTION;
}
}

}

I did read through the JSR-168 specs and was about to do a total revamp of my portlet classes when I realized this viewAction variable is nowhere declared. This if (Validator.isNull(viewAction)) line is actually quite standard across the struts portlets in Liferay and I had taken it for granted. What the heck, I tried commenting it out and did re-deployed. Voila! Everything works fine now and all the portlets are rendering the right content. Lesson learnt.

No comments: