cancel
Showing results for 
Search instead for 
Did you mean: 

Use custom taglibs in Portal Component

Former Member
0 Kudos

Hello,

I'm trying to use a custom Taglib in the JSP file of a Portal Component. Therefore I created a reference in the JSP via <%@ taglib uri="/PORTAL-INF/taglib/helloWorldTag.tld" prefix="hello" %> . The tld file is located in the folder /PORTAL-INF/taglib/ and is named helloWorldTag.tld.

I always get the error com.sapportals.portal.prt.servlets_jsp.server.jsp.ParseException: Error in parsing taglib '/PORTAL-INF/taglib/helloWorldTag.tld' tag in web.xml or .tld file of the taglib library.

Can anybody tell what I am missing?

Thanks and best regards

Dominik

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Look in below link...

I think you have made some mistake in mapping of your TLD in Web.xml....

http://www.java2s.com/Tutorial/Java/0360__JSP/CustomTagWebXMLTagLib.htm

Former Member
0 Kudos

Hi Saurabh ,

thanks for the reply. Problem is that there is not web.xml in a Portal Component, so I think I have to do it in the portalapp.xml which might work slightly different? Any idea?

Thanks and best regards,

Dominik

Former Member
0 Kudos

I think below article will answer your query....

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/40599e45-8cf9-2910-cbaa-d4cd8e15f...

revert back once done....!!

Edited by: Saurabh Agarwal on Jun 14, 2011 12:43 PM

Former Member
0 Kudos

Hi Saurabh,

thanks for thetutorial.

I think I am one step further but I encounter a strange behaviour now:

When I implement all steps as described in the tutorial, I get the following error message:

04:41_14/06/11_0022_4093353

[EXCEPTION]

java.lang.VerifyError: (class: com/hclt/custom/tags/GreetingTag, method: doStartTag signature: ()I) Incompatible object argument for function call

at jsp._sapportalsjsp_index.subDoContent(_sapportalsjsp_index.java:82)

at jsp._sapportalsjsp_index.doContent(_sapportalsjsp_index.java:40)

at jsp._sapportalsjsp_index.service(_sapportalsjsp_index.java:24)

at com.sapportals.portal.prt.core.broker.PortalComponentItemFacade.service(PortalComponentItemFacade.java:360)

at com.sapportals.portal.prt.core.broker.PortalComponentItem.service(PortalComponentItem.java:934)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:435)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:527)

at com.sapportals.portal.prt.component.PortalComponentRequest.dispatchRequest(PortalComponentRequest.java:1063)

at CustomTagComponent.doForward(CustomTagComponent.java:11)

at CustomTagComponent.doContent(CustomTagComponent.java:7)

at com.sapportals.portal.prt.component.AbstractPortalComponent.doPreview(AbstractPortalComponent.java:240)

at com.sapportals.portal.prt.component.AbstractPortalComponent.serviceDeprecated(AbstractPortalComponent.java:168)

at com.sapportals.portal.prt.component.AbstractPortalComponent.service(AbstractPortalComponent.java:114)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)

at com.sapportals.portal.prt.component.PortalComponentResponse.include(PortalComponentResponse.java:215)

at com.sapportals.portal.prt.pom.PortalNode.service(PortalNode.java:645)

at com.sapportals.portal.prt.core.PortalRequestManager.callPortalComponent(PortalRequestManager.java:328)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:136)

at com.sapportals.portal.prt.core.PortalRequestManager.dispatchRequest(PortalRequestManager.java:189)

at com.sapportals.portal.prt.core.PortalRequestManager.runRequestCycle(PortalRequestManager.java:753)

at com.sapportals.portal.prt.connection.ServletConnection.handleRequest(ServletConnection.java:235)

at com.sapportals.portal.prt.dispatcher.Dispatcher$doService.run(Dispatcher.java:541)

at java.security.AccessController.doPrivileged(Native Method)

at com.sapportals.portal.prt.dispatcher.Dispatcher.service(Dispatcher.java:430)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)

at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)

at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)

at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)

at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)

at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)

at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)

at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)

at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)

at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)

at java.security.AccessController.doPrivileged(Native Method)

at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:104)

at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:176)

But when I comment all lines in the doStartTag() method like this

public int doStartTag() throws JspException {

// try {

// Locale locale = pageContext.getRequest().getLocale();

// String sOutput = sayHello(locale);

// pageContext.getOut().write("<BR>" + sOutput);

// Calendar cal = Calendar.getInstance(locale);

// pageContext.getOut().write(

// "<BR> Server Time is - " + cal.getTime());

// } catch (Exception ex) {

// throw new JspException("Error:" + ex);

// }

return EVAL_PAGE;

}

the JSP page compiles and I see a blank screen (as expected).

I am not sure about the step in the tutorial, where I should add the Servlet.jar to the project classpath. I added the j2ee-1.4.jar to the lib folder of the project.If I just but the JAR to the build path I get a java.lang.NoClassDefFoundError: javax/servlet/jsp/JspContext Exception. Maybe here is something is wrong?

Any further ideas?

Thanks and best regards,

Dominik

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

my bad. I took the servlet.jar from the server. This turned it tight.

Thanks again and best regards,

Dominik