I’m trying to use a custom taglib in a portlet application.
The portlet uses Spring MVC Portlet, but I don’t think that’s relevant here.
The tag extends TagSupport. It tries to get the HttpSession using pageContext.getSession(), but it returns null resulting in a NullPointerException in the later code.
public class keyboard extends TagSupport {
public int doStartTag() {
...
HttpSession session = pageContext.getSession();
...
session.setAttribute("sesKeyboad", keyboard); // <-- NullPointerException
}
}
I’m not supposed to modify the taglib, it already worked in another portlet.
Any idea why the HttpSession is not initialized in the pageContext ?
It’s possible that the JSP containing the associated tag is using the
pagedirective and setting itssessionattribute tofalse.