Additional Blogs by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

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:





" +
"

" +
"" +
"" +
"" +
"" +
"" +
"" +
"

"+strText+"

" +
"

";
}
else{

htmlControlText = "" +
"

" +
"" +
"" +
"" +
"" +
"" +
"" +
"

"+strText+"

" +
"

";
}

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;

  }

}

2 Comments