Skip to Content

Scenario

The client wants to maintain uniform look and feel across Enterprise Portal, Corporate website and different in-house web applications. Thereby, the client wants the same set of customized UI controls to be used across all the web applications.

Pre-requisites

JDK

PDK

NetWeaver Developer Studio

Step By Step Procedure

1. Create a class which extends Component Class


This class should define the getter and setter methods for all your tag attributes.

Code Sample:

2. Create a tag handler class for the UI element. This class extends TagSupport.

This class helps you to create the tag and make it available for use in HTML or JSPs.

Code Sample:

” +

” +
“” +
“” +
“” +
“” +
“” +
“” +

” +

“;
}
else{

htmlControlText = “” +

” +
“” +
“” +
“” +
“” +
“” +
“” +

” +

“;
}

out.write(htmlControlText);

}catch(Exception ex){

ex.printStackTrace();
}

return 1;
}

// Define the doEndTag method
public int doEndTag() throws JspException
{
return super.doEndTag();
}
}

3. Create a service

Code Sample:

  import com.sapportals.portal.prt.service.IServiceContext;

  public class SDNControlService implements ISDNControlService{

  private IServiceContext mm_serviceContext;

  /**

 

  • Generic init method of the service. Will be called by the portal runtime.

 

  • @param serviceContext

  */

  public void init(IServiceContext serviceContext)

  {

    mm_serviceContext = serviceContext;

  }

  /**

 

  • This method is called after all services in the portal runtime

 

  • have already been initialized.

  */

  public void afterInit()

  {

  }

  /**

 

  • configure the service

 

  • @param configuration

 

  • @deprecated

  */

  public void configure(com.sapportals.portal.prt.service.IServiceConfiguration configuration)

  {

  }

  /**

 

  • This method is called by the portal runtime

 

  • when the service is destroyed.

  */

  public void destroy()

  {

  }

  /**

 

  • This method is called by the portal runtime

 

  • when the service is released.

 

  • @deprecated

  */

  public void release()

  {

  }

  /**

 

  • @return the context of the service, which was previously set

 

  • by the portal runtime

  */

  public IServiceContext getContext()

  {

    return mm_serviceContext;

  }

  /**

 

  • This method should return a string that is unique to this service amongst all

 

  • other services deployed in the portal runtime.

 

  • @return a unique key of the service

  */

  public String getKey()

  {

    return KEY;

  }

}

image

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. IMRAN MOHAMMED
    I appreciate your efforts in writting the code sample. As a beginner could you please tell me where shoul I write these code and the directory structure to be used.
    I know NWDS, do u mean to develop the webdynpro application with the given code and then creating the iview of webdynpro in portal.

    thnaks

    (0) 

Leave a Reply