cancel
Showing results for 
Search instead for 
Did you mean: 

Using a custom service in masthead

Former Member
0 Kudos
57

Hi,

We have a custom service which returns a string.We would like to display the string in the masthead.

I have added the sharing reference to the custom service and using the following code to get the String

private String GetOrgCode(IPortalComponentRequest request){
			
			IUserContext userContext = request.getUser();
			IConnectionService cgservice =(IConnectionService) PortalRuntime.getRuntimeResources().getService(IConnectionService.KEY);
			String s=cgservice.getOrgDesc(userContext.getLogonUid());
			return s;
}

And display the string using <%=GetOrgCode(componentRequest)%>

The masthead on the portal does not display the string and when I preview the masthead from portal content I am getting an error which says:

Caused by: com.sapportals.portal.prt.component.PortalComponentException: Error occurs during the compilation of java generated from the jsp

What is wrong in the code or Have I missed something?

Thanks,

Suparna

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

The componentRequest variable won't be visible in jsp.

Invoke the method GetOrgCode() from ur portal component,pass the current user as an argument and see if u get the string displayed in the masthead.

Hope it helps.

Regards,

M.Subathra

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Subathra,

Thanks for your reply!

I managed to solve the problem.I have awarded you points.

Daniel,

We can define funtions.

Thanks,

Suparna

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos

Hi Suparna,

I don't believe you can define a function in JSP.

Daniel