Skip to Content
0
Former Member
Feb 02, 2007 at 05:27 PM

htmlb link setOnClientClick giving NullPointerException

80 Views

I have a htmlb link tag in a JspDynPage that I'm trying to execute some javacript with when the link is clicked. The problem I'm having is that when I run the component I get a NullPointerException. Here is the code that is failing...

<hbj:link id="link1" text="test link" reference="" tooltip = "This is a test link" target="_blank" >
	<% 
	link1.setOnClientClick("alert('Click')");
	%>
</hbj:link> 

The error is

....
Caused by: java.lang.NullPointerException
at com.sapportals.htmlb.event.EventManager.renderJavaScriptFragment(EventManager.java:436)
at com.sapportals.htmlb.event.LinkClickEvent.renderJSFunction(LinkClickEvent.java:95)
at com.sapportals.htmlb.unifiedrendering.ie5.LinkRenderer.render(LinkRenderer.java:42)
at com.sapportals.htmlb.rendering.PageContext.render(PageContext.java:982)
at com.sapportals.htmlb.taglib.LinkTag.doEndTag(LinkTag.java:95)
...

I've also try the .setClientEvent(EventTrigger.ON_CLICK,"....") method with simular results.